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
You can repeat a command in word by pressing the ____ function key.
valentinak56 [21]
You would repeat a command in word by pressing the F4 function key
4 0
3 years ago
Read 2 more answers
Human services organizations seek to make changes and help people in need to improve their .
bixtya [17]

Answer:

quality of life

Explanation:

7 0
3 years ago
The decimal equivalent of the product of 1011 and 1100 is
faltersainse [42]

Answer:

132

Explanation:

We convert each number to base 10 (decimal) and multiply.

So 1011₂ = 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰

= 1 × 8 + 0 × 4 + 1 × 2 + 1 × 1

= 8 + 0 + 2 + 1

= 11₁₀

1100₂ = 1 × 2³ + 1 × 2² + 0 × 2¹ + 0 × 2⁰

= 1 × 8 + 1 × 4 + 0 × 2 + 0 × 1

= 8 + 4 + 0 + 0

= 12₁₀

So, 1011₂ × 1100₂ = 11₁₀ × 12₁₀ = 132₁₀

So, the decimal equivalent of the product of 1011 and 1100 is 132

3 0
2 years ago
Complete the sentence based on your knowledge of directing TV shows.
WINSTONCH [101]

Answer

Directing a drama is somewhat similar to directing a discussion program

6 0
3 years ago
Which section of a cover letter would include your skills education and work experience
trasher [3.6K]
Resume. I do believe
8 0
3 years ago
Read 2 more answers
Other questions:
  • It takes you 0.8 of a minute to read each page of your health book. It takes you 5.5 minutes to take the test at the end. How lo
    10·2 answers
  • If you want a user to enter exactly 20 values which loop would be the best to use
    12·1 answer
  • Which hardware device connects your network to the internet?
    11·1 answer
  • Given an array temps of double s, containing temperature data, compute the average temperature. Store the average in a variable
    14·1 answer
  • Which statements are true about making formatting changes to cells in Excel? (Select all that apply)
    11·1 answer
  • What are the advantages and disadvantages of nuclear energy?
    14·1 answer
  • Please help me ASAP! Here is the question.
    15·1 answer
  • Is a dot matrix printer an impact or non-impact printer
    12·2 answers
  • Look at the code below. What does it do?
    8·1 answer
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!