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 relational database can best be described as a collection of related _____ designed to minimize redundant data.
blondinia [14]

A relational database can best be described as a collection of related tables designed to minimize redundant data.

<h3>What is a relational database?</h3>

A relational database is known to be a type of database that keeps and gives people room or access to data points that are known to be linked to each other.

Conclusively,  Relational databases are known to have relational model, an good and specific way of showing data through the use of tables.

Learn more about relational database from

brainly.com/question/13262352

7 0
3 years ago
how can people access to a range of online services affect their ability to operate safely in the digital world
Andru [333]
Have parental controls on certain sites
3 0
3 years ago
What type of encoding is this?<br>0x6a656c6c7966697368<br>cause I'm trying to decode it
katen-ka-za [31]
According to its structure I'd say that this is SEAL (<span>Software-Optimized Encryption Algorithm). It's difficult to describe how it works, because this kind of ciphers is very tricky. This algorithm uses 160 bit key and it uses 3 tables (R, S, T) to encode and decode.

I'll attach the image where you can see a process of creating a pseudo-random function:
</span>

7 0
3 years ago
Define an iterative function named alternate_i; it is passed two linked lists (ll1 and ll2) as arguments. It returns a reference
zmey [24]

Answer:

answer is attached

5 0
4 years ago
EdHesive 3.7 Code Practice?
devlian [24]

Answer:

if 3 + 3 == 6:

 print("Hey 3 and 3 is 6")

 if 5 + 3 == 8:

   print("You are not going to catch me")

   if 5 + 6 == 10:

     print("****nag*****")

   else:

     print("You thought like 5 + 6 = 11 ")  

     if 6 + 6 == 12:

       print("Great! This one is correct")

       if 5 + 7 == 12:

         print("Great, this is correct as well")

         if 3 + 3 == 4 and 5 + 5 == 10:

           print("Great! Congrats")

Explanation:

Please check the answer, and practice if else and various other ladders as much as you can.

8 0
4 years ago
Other questions:
  • Using the FAFSA form , you can for apply for what
    14·2 answers
  • Microsoft's Xbox operating system provides Xbox programmers with a set of common standards to use to access controllers, the Kin
    15·1 answer
  • What is the process of designing green buildings called
    9·2 answers
  • Design two subclasses of Employee…SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An ho
    12·1 answer
  • Two DHCP servers, Server1 and Server2, are running Windows Server 2016. As the administrator, you create a scope called Scope1.
    8·1 answer
  • Which of the following best describes how to measure the spread of the data? a) The IQR is a better measure of spread for badmin
    5·1 answer
  • Write a program that will sort an array of data using the following guidelines - DO NOT USE VECTORS, COLLECTIONS, SETS or any ot
    10·1 answer
  • Three materials needed to stream video video content
    10·2 answers
  • Examples of ________, which is hosted on a web site, include e-mail, word processing, tax preparation, and game programs.
    9·1 answer
  • Your friend Cameron’s little sister is visually impaired. Cameron is worried that his sister will not be able to use technology
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!