subject

In this exercise, we are going to create a static class Randomizer that will allow users to get random integer 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.

This is what I have so far:

public class RandomizerTester
{
public static void main(String[] args)
{

System. out. println("Results of Randomizer. nextInt()");
for(int i = 0; i < 10; i++)
{
System. out. println(Randomizer. nextInt());
}

//Initialize min and max for Randomizer. nextInt(min, max)
int min = 5;
int max = 10;
System. out. println("\nResults of Randomizer. nextInt(5,10)");
for(int i = 0; i < 10; i++)
{
System. out. println(Randomizer. nextInt(min ,max));
}

}
}

public class Randomizer
{
private static int range;
private static int startingNum;
private static int nextInt;
private static int max;
private static int min;

public static int nextInt()
{
//Implement this method to return a random number from 1-10
//Randomizer randInteger = new Randomizer();
int randInteger = (int)(Math. random() * (11) + startingNum);
return Randomizer. nextInt;
}

public static int nextInt(int min ,int max)
{
//Implement this method to return a random integer between min and max
int randInteger = (int)(Math. random() * (max - min + 1) + min);
return Randomizer. nextInt(min, max);

}
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
1.the index finger on your right hand types the f r v 4 j u m 7 h y 6 n lo.9 j u 7 m g t 5 b 2.if you need to multiply 400, 2, and 1 ½, what would you type on the numeric keypad? 400*2*1.5 400/2*1.5 400/2/1.5 400*2*1½ 3.select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair. rest your palms on the keyboard. relax your fingers. keep your hands lower than your elbows.
Answers: 1
question
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Alex’s family members live in different parts of the world. they would like to discuss the wedding plans of one of their distant relatives. however, alex wants all the family members to talk to each other simultaneously so that they can make decisions quickly. which mode of internet communication should they use? a. blog b. email c. wiki d. message board e. instant messaging
Answers: 2
question
Computers and Technology, 24.06.2019 07:30
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
You know the right answer?
In this exercise, we are going to create a static class Randomizer that will allow users to get rand...
Questions
question
History, 22.10.2020 05:01
question
Mathematics, 22.10.2020 05:01
question
English, 22.10.2020 05:01
Questions on the website: 13722363