This is a short lab (so you have some time to work on Project 1) that gives you a little experience with using inheritance to add functionality.

Modifying/extending Random

Copy the following program:

Compile and run it. You should see a random-looking sequence of 70 integers inthe range 1..6. Look closely, and take note of any consecutive occurences of the same number, e.g. 55 or 22. It's possible that you might run this and not find a repetition, but extremely unlikely!

Suppose you wanted to produce sequences of random-looking numbers subject to the constraint that no consecutive numbers in the sequence could be the same? Your job is to create a new class NRRandom (Non-Repeating Random) that works this way. Specificially, you will use inheritance to create the class NRRandom that behaves exactly like Random does, except that calls to nextInt(int n) never produce the same number on consecutive calls. If you do this properly, the original Lab05, modified only by replacing Random with NRRandom, should give us what we want. I.e. the following program:

should produce a random-looking sequence of 70 integers in the range 1..6, with no repeated numbers in consecutive positions.

Note: You must use inheritance to do this, and if you do it right, your solution should be short and sweet. You'll definitely want to look at the Java API documentation for class Random.

Submission: For this lab, you will simply demo your solution for your instructor. It must be finished in Lab. After you are finished, you will stay and work on your project.