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 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
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
Mathematics, 05.05.2020 18:15
question
Mathematics, 05.05.2020 18:15
question
History, 05.05.2020 18:15