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
pshichka [43]
2 years ago
14

Exercise : Randomizer In this exercise, we are going to create a static class Randomizer that will allow users to get random int

eger values from the method nextInt() and nextInt(int min, int max). Remember that we can get random integers using the formula int randInteger = (int)(Math.random() * (range + 1) + startingNum). nextInt() should return a random value from 1 - 10, and nextInt(int min, int max) should return a random value from min to max. For instance, if min is 3 and max is 12, then the range of numbers should be from 3 - 12, including 3 and 12.
Computers and Technology
1 answer:
Nutka1998 [239]2 years ago
4 0

Answer:

Here the code is by using java.

Explanation:

//Randomizer.java

public class Randomizer {

public static int nextInt() {

//get random number from 1-10

int randInteger = (int) (Math.random() * (11) + 1);

//if number is greater than 10 or less than 1

while (randInteger > 10 || randInteger < 1) {

randInteger = (int) (Math.random() * (11) + 1);

}

return randInteger;

}

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

//formula to get random number from min-max

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

while (randInteger > max || randInteger < min) {

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

}

return randInteger;

}

}

//RandomizerTester.java

public class RandomizerTester {

public static void main(String[] args) {

System.out.println("Results of Randommizer.nextInt()");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt());

}

int min = 5;

int max = 10;

System.out.println("\n Results of Randomizer.nextInt(5,10)");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt(min, max));

}

}

}

OUTPUT:

Results of Randommizer.nextInt()

9

2

3

8

5

9

4

1

9

2

Results of Randomizer.nextInt(5,10)

9

8

9

7

5

10

5

10

7

7

You might be interested in
JAVA
ivolga24 [154]

import java.util.Scanner;

public class JavaApplication57 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter two numbers:");

       int num1 = scan.nextInt();

       int num2 = scan.nextInt();

       while (num1 <= num2){

          if (num1 %2 == 0){

              System.out.print(num1+" ");

          }

          num1+=1;

       }

   }

   

}

I hope this helps!

6 0
3 years ago
In cell I8, enter a nested logical function to display Need to Remodel if the apartment is unoccupied (No) AND was last remodele
galina1969 [7]

Answer:

The Function is given as

=IF(AND(E8="No",G8>10),"Need to remodel","No Change")

Explanation:

The syntax of the IF condition in excel is given as

IF(Test,If true,If false)

So here the test is an and component such that the house has to be unoccupied which is indicated as E8 because the E column contain the occupancy of the apartments, and the G8 is the last remodeling time, so the test statement is the AND operation of the conditions as

E8="No" indicating that house is unoccupied

G8>10 indicating that the last remodelling was more that 10 years ago

So the test is given as

AND(E8="No",G8>10)

Now the statement if the test true is the recommendation for to remodel, so

"Need to remodel"

Now the statement if the test is false is given as

"No Change"

So the overall function becomes

=IF(AND(E8="No",G8>10),"Need to remodel","No Change")

3 0
2 years ago
What is Microsoft Excel?​
pashok25 [27]

Answer:

The most popular and widely used spread sheet program, developed by Microsoft Corporation of USA is called Microsoft Excel.

Explanation:

Thanks!!!!!

5 0
3 years ago
The _____ is a computer-based test that measures the degree to which you associate particular groups of people with specific cha
scoray [572]

Answer:Implicit Association Test (IAT)

Explanation:Implicit Association Test is the sort of test that is made for the analyzing the thoughts and beliefs of group of people . It is basically performed because of displaying the unknown facts or attitude which people don't want to display or don't want to report.

Implicit Association Test (IAT) is the test that helps in bringing out the hidden and unreported situations or facts about the people.

3 0
2 years ago
Explain block diagram of. computer architure​
ozzi

Answer:

A block diagram is a diagram of a system in which the principal parts or functions are represented by blocks connected by lines that show the relationships of the blocks. They are heavily used in engineering in hardware design, electronic design, software design, and process flow diagrams.

Explanation:

In your question you asked architure but maybe it is architecture (•;

5 0
2 years ago
Other questions:
  • What is the IEEE standard for the Wi-Fi Protected Access 2 (WPA2) security protocol?
    6·1 answer
  • What is ment by creative middle way solution
    6·1 answer
  • You often insert your company's logo into documents you create. One way to make it easier for you to quickly insert it is to sav
    10·1 answer
  • What should a safe username do?
    14·2 answers
  • In regard to protective actions for explosive devices, the area where the blast originates is referred to as ___________ perimet
    8·1 answer
  • Consider the following code segment. for (int a = 0; a &lt; 10; a++) { for (int b = 10; b &gt; a; b--) { System.out.print("#");
    6·1 answer
  • Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d
    8·1 answer
  • The arrows in this question indicated the determination of two attributes. For example, the arrow that goes ProductID to Product
    11·1 answer
  • What are the services offered by web-based email?​
    12·1 answer
  • The inFS.open(str) function has a string parameter str that specifies the _____ of the file to open.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!