1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Hunter-Best [27]
3 years ago
5

Write four overloaded methods called randomize. Each method will return a random number based on the parameters that it receives

:
a. randomize() - Returns a random int between min and max inclusive. Must have two int parameters.

b. randomize() - Returns a random int between 0 and max inclusive. Must have one int parameter.

c. randomize() - Returns a random double between min and max inclusive. Must have two double parameters.

d. randomize() - Returns a random double between 0 and max inclusive. Must have one double parameter.
Computers and Technology
2 answers:
Scilla [17]3 years ago
8 0

Answer:

The Java code given below

Explanation:

//import package

import java.util.Scanner;

//Java class

class Lesson_35_Activity {

  // returns random int b/t min and max inclusive; has 2 int parameters

  public static int randomize(int min, int max) {

      int x = (int) (Math.random() * ((max - min) + 1)) + min;

      return x;

 

Yuri [45]3 years ago
6 0

Answer:

The Java code given below

Explanation:

//import package

import java.util.Scanner;

//Java class

class Lesson_35_Activity {

  // returns random int b/t min and max inclusive; has 2 int parameters

  public static int randomize(int min, int max) {

      int x = (int) (Math.random() * ((max - min) + 1)) + min;

      return x;

  }

  // returns random int b/t 0 and max inclusive; has one int parameter

  public static int randomize(int max) {

      int x = (int) (Math.random() * (max + 1));

      return x;

  }

  // returns random double b/t min and max inclusive; two double parameters

  public static double randomize(double min, double max) {

      double x = (double) (Math.random() * ((max - min) + 1)) + min;

      return x;

  }

  // returns random double b/t 0 and max inclusive; has one double parameter.

  public static double randomize(double max) {

      double x = (double) (Math.random() * (max + 1));

      return x;

  }

  // main method, which is entry point of the program

  public static void main(String[] args) {

      // object of Scanner class

      Scanner scan = new Scanner(System.in);

      // asking min and max number

      System.out.print("Enter min number : ");

      int mi = scan.nextInt();// reading min number

      System.out.print("Enter max number : ");

      int ma = scan.nextInt();// reading max number

      // checking number

      if (mi < ma) {

          System.out.println(randomize(mi, ma));// method call

          System.out.println(randomize(0, ma));// method call

          double mii = mi;

          double maa = ma;

          System.out.printf("%.2f", randomize(mii, maa));

          System.out.printf("\n%.2f", randomize(0, maa));

      } else {

          // when minimum number is greater than maximum number then display

          System.out.println("Enter min number " + mi + " should be less than max " + ma);

      }

  }

}

You might be interested in
What type of organism forms the base of food webs?
kotegsom [21]
A producer <span>forms the base of food webs</span>.
7 0
3 years ago
During prereading, it is not important to pay attention to visual aids. please select the best answer from the choices provided
Nadusha1986 [10]
True Because the visual aids will provide better hand to eye coordination
7 0
1 year ago
Mention any four features which a standard computer laboratory should have​
Vera_Pavlovna [14]

Answer:

•Make sure doorway openings are at least 32 inches wide and doorway thresholds are no higher than 1/2 inch.

•Keep aisles wide and clear for wheelchair users.

•Make sure all levels of the lab are connected by a wheelchair-accessible route of travel.

For students with mobility impairments, make sure there are procedures in place for retrieving materials that may be inaccessible.

Make sure ramps and/or elevators are provided as an alternative to stairs. Elevators should have both auditory and visual signals for floors. Elevator buttons should be marked in large print and Braille or raised notation and easily reachable for wheelchair users.

Locate the lab near wheelchair-accessible restrooms with well-marked signs.

Service desks need to be wheelchair-accessible.

Provide ample, high-contrast, large-print directional signs throughout the lab. Mark equipment in the same fashion.

Provide study carrels, hearing protectors, or private study rooms for users who are easily distracted by noise and movement around them.

Provide at least one adjustable-height table with easily reachable controls for each type of computer.

Have wrist rests available to those who require extra wrist support while typing.

Keep document holders available to help users position documents for easy reading.

5 0
3 years ago
Read 2 more answers
What method can be used to determine if an email link is authentic?
Sloan [31]
A password and pin hope this helps :D
3 0
3 years ago
Which of the following experiences is considered a simulation?
Butoxors [25]

Answer:

c

Explanation:

3 0
3 years ago
Other questions:
  • Imagine that you are an independent filmmaker making a feature-length narrative film in the United States, with a variety of bot
    11·2 answers
  • Which of the following is not true about VOIP?
    9·1 answer
  • How is a website most likely to distinguish its different sections?
    8·1 answer
  • Why is it important to put the most specific case first? What types of errors does it help avoid?
    11·1 answer
  • Explain the bad effect and good effect of mobile phone and internet.<br>​
    15·2 answers
  • Anyone on ps4 willing to trade me a fennec or McClaren on rocket league?
    6·2 answers
  • Which example best demonstrates an impact of computers on the economy?
    6·1 answer
  • Computers that are joined together are called networks true or false
    10·1 answer
  • What kind of energy transformation occurs when you call someone on a cell phone?
    11·1 answer
  • Aii so is anyone pushing P?<br> if u are u a g
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!