Project 4 The Random class implements a random number

advertisement
Project 4
The Random class implements a random number generator, which produces
sequences of numbers that appear to be random. To generate random integers, you
construct an object of the Random class, and then apply the nextInt method. For
example, the call generator.nextInt(6) gives you a random number between 0 and 5.
Write a program LotteryPrinter that picks a combination in a lottery. In this lottery,
players can choose 6 numbers (possibly repeated) between 1 and 49. Your program
should print out a sentence such as “Play this combination – it’ll make you rich!”,
followed by a lottery combination.
Sample Output:
Play this combination --it'll make you rich!
19
24
3
16
46
33
Download