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
In python,_______ are used to define the conditions necessary for a while loop to run.
-BARSIC- [3]

Answer:

Relational Operators

Explanation:

We can make a while loop run only when some variable or whatever is relative to something else.

The valid operators are:

<, >, =, <=, >=, and =!

Hope this helped!

8 0
3 years ago
Read 2 more answers
Research and discuss the LAMP (Linux, Apache, MySQL, and PHP) architecture. What is the role of each layer of this software stac
Vsevolod [243]

Answer:

Answered below

Explanation:

LAMP is an example of a web service stack. It is used for developing dynamic websites and applications. It's components include;

1) The Linux operating system, which is built on open source and free development and distribution. Types of Linux distributions include: Ubuntu, Fedora and Debian. This operating system is where sites and applications are built on.

2) The Apache HTTP server. Apache server is developed by the Apache software Foundation and is open source. It is the most popular web server on the internet and plays a role in hosting websites.

3) MySQL is a relational database management system that plays a role in the storage of websites data and information.

4) The PHP programming language is a scripting language for web development whose commands are embedded into an HTML source code. It is a popular server-side language used for backend development.

8 0
3 years ago
Which component is most likely to allow physical and virtual machines to communicate with each other?
Diano4ka-milaya [45]

A component which is most likely to allow both physical and virtual machines to communicate with each other is a: virtual switch.

<h3>What is virtualization?</h3>

Virtualization can be defined as the creation of an abstract layer over computer hardware primarily through the use of a software, in order to enable the operating system (OS), storage device, server, etc., to be used by end users over the Internet.

In Cloud computing, some of the components (features) which is not required for a successful virtualization environment include the following:

  • Virtual machine
  • Host machine
  • Hypervisors

In conclusion, we can infer and logically deduce that a component which is most likely to allow both physical and virtual machines to communicate with each other is a virtual switch because it enables the virtual servers and the desktops to communicate.

Read more on virtualization here: brainly.com/question/14229248

#SPJ1

Complete Question:

Which component is most likely to allow physical and virtual machines to communicate with each other?

VHD.

Virtual switch.

Hyper V.

Host OS.

8 0
1 year ago
The National Archives is part of the federal government, which means that its content:
RUDIKE [14]

Answer:

belongs to everyone.

Explanation:

A National Archive can be defined as the collection of data (informations) and documents by the government of a particular country for record keeping purposes.

Basically, these documents comprises of information about important and historical events that have happened in the country or events generally related with the country.

Hence, the National Archives is part of the federal government, which means that its content belongs to everyone. This is simply because the federal government is a government of the people, for the people and by the people. Thus, the ownership of governmental institutions or agencies belongs to the general public i.e the citizens of the country.

4 0
3 years ago
Ian’s photography teacher asks him to take some photos of a few different species over the weekend. Which group of photos would
alina1380 [7]
I think it’s b or d..............
5 0
3 years ago
Other questions:
  • A ___ is the basic collective unit of data in a computer.
    12·1 answer
  • What should you do prior to writing your business document?
    11·1 answer
  • Write a program in java that reads each line in a file, reverses its characters, and writes the resulting line to another file
    15·1 answer
  • Print a countdown from n to 1 The function below takes one parameter: an integer (begin). Complete the function so that it print
    8·1 answer
  • A bicycle combination lock has four rings with numbers 0 through 9. Given the actual numbers and the combination to unlock, prin
    13·1 answer
  • Pls help me
    5·1 answer
  • Use the_____icon to insert a new record.<br><br> A. *<br> B. X<br> C. =<br> D. &amp;
    11·1 answer
  • 11) A single inheritance model means: * A) A class can only have one parent class (superclass) B) A class can only have one chil
    7·1 answer
  • Calcula l'energia (Kwh) consumida per una màquina de 30 CV que funciona durant 2 hores.
    12·1 answer
  • A. Suppose a CPU with a write-through, write-allocate cache achieves a CPI of 2. What are the read and write bandwidths (measure
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!