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]
4 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]4 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]4 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
A skillful response consist of two parts: affirmation andanswer<br><br> True<br><br> False
antoniya [11.8K]

Answer: False

Explanation:

A skillful response is defined as, answering the response in a skillful manner with all the technical and skillful approach. Firstly, read the question carefully and answer according in a proper format manner. Affirmation and answer are not enough for the skillful response as, it also include various kinds of approach like it should be error free and declaration of the answer should be in format, meaningful and proficient.

7 0
3 years ago
Write and test a Python program to find and print the largest number in a set of real (floating point) numbers. The program shou
fenix001 [56]

I can't read oooooyeaaaa

3 0
4 years ago
Regarding the Internet of Things (IoT), a business involved in utilities, critical infrastructure, or environmental services can
jeka94

Answer:

A. true

Explanation:

Based on the information provided within the question it can be said that the statement is completely true. This is because, traffic-monitoring applications have the main function of monitoring and analyzing the flow of traffic of one or various different items. Which can be applied to the business involving utility, infrastructure, and environmental services by monitoring the specific items regarding each business. Therefore making sure that enough product is entering or leaving each business as it is suppose to. As well as providing stock analysis and defective product alerts.

6 0
4 years ago
Several of the items below indicate the steps required to add a slide to a presentation. Select those steps and indicate the ord
ss7ja [257]

Answer:

Click on the New Slide icon.  2.

Enter the slide position desired. N/A

Click where you want to add the slide.  1.

Select New Slide from the Tools menu.  3.

Switch to the Normal or Slide Sorter view. 4.

Switch to the Notes or Outline view. 5.

Explanation:

You can never enter the slide position desired, and you need to click on the slide after which you want the new slide to be placed.  Thus, enter the slide position desired is not applicable, and you need to click where you want to add the slide, and more accurately after which. Hence, this is the 1st. Now you need to click on the new slide icon. Then you need to select the new slides from the tools menu. The slide will appear in Normal view, and you can design the slide now as well as add the notes. You can then move to slide sorter view to arrange the slides, or you can arrange from the slide tab as well. Finally to check(edit) the notes and outline you can change the view to notes or Outline view. Hence, the above answer.

Keep in mind that through presenter view, you can make the slide show where you can see the slides and your notes, and the listeners can see the slides only.

7 0
3 years ago
What is the sentinel value in the following code snippet?
Airida [17]
The answer to the problem is 5
7 0
3 years ago
Other questions:
  • Jonas is an experienced security professional who recently accepted a position in an organization that uses Check Point firewall
    9·1 answer
  • While reviewing some web page code, you notice that the html is written in all lowercase letters. you are not sure which version
    14·1 answer
  • . what action does the following a default operator perform? int a, b, c; a = b + c;
    14·1 answer
  • What are Important advice to include about spyware, viruses, and other types of malware?
    8·1 answer
  • Complete the GiftCard class shown below. A GiftCard keeps track of the current balance on the card. A gift card starts with a be
    11·1 answer
  • Discuss briefly general-purpose graphicsprimitives that contain 2D graphics library.
    15·1 answer
  • What kind of data are spreadsheets typically used with?
    6·1 answer
  • What allows a programmer to write code quickly and efficiently for an action that must be repeated?
    14·1 answer
  • NFPA 780, Standard for the Installation of Lightning Protection Systems provides information on the installation of _____ for li
    6·1 answer
  • Cho lược đồ CSDL “Quản lý BÁN HÀNG” có các bảng như bên dưới. (Thuộc tính in đậm và
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!