Question: JAVA Exercise 1: Random Number Generator Class (40 points) Pleasedevelop a class called RandomNumberGenerator that represents arandom number generator. The class should have a constructor

JAVA

Exercise 1: Random Number Generator Class (40 points) Pleasedevelop a class called RandomNumberGenerator that represents arandom number generator. The class should have a constructor thatdoes not take any argument (default constructor), which will makean object variable constructed from this class to generate aninteger value between 1 (inclusive) and 6 (inclusive). Anotherconstructor takes two integer values as its arguments to explicitlyset these two limits. The constructor should store these two limitvalues in private instance variables called upperLimit andlowerLimit. Define public accessor and mutator member methodscalled getUpperLimit and getLowerLimit, and setUpperLimit andsetLowerLimit to retrieve and update these two limit values. Definea public method called nextValueInt that takes no argument,generates and returns a integer random number in the rangespecified by upperLimit and lowerLimit. You can use library classRandom from util package in your class implementation for randomnumber generation. To generate random integers, you construct anobject of the Random class, and then apply the nextInt method. Forexample, the call randomObject.nextInt(6) gives you a random numberbetween 0 and 5. (24 points)Please test your implementation of theRandomNumberGenerator class using a separate tester class namedEx1. The main method in class Ex1 starts your Java program. Themain method in Ex1 should test all member methods at least once.The main method should also uses the RandomNumberGenerator class tosimulate a lottery machine that picks a combination in a lottery.In this lottery, players can choose 6 numbers (possibly repeated)between 1 and 69. Construct an object of RandomNumberGeneratorclass and invoke an appropriate method to generate each number.Your program should print out a sentence in a separate line such as"Play this combination - it will make you rich!", followed by alottery combination. (12 points) Please provide java-doc commentsfor all member methods and classes that you use in your code. (4points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!