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.
1
Expert's answer
2013-07-22T11:51:20-0400
import java.util.Random;
public class LotteryPrinter { public static void main(String[] args) { System.out.println("Play this combination - it'll make you rich!"); Random rnd = new Random(); for (int i = 0; i < 6; i++) { System.out.print(rnd.nextInt(49) + 1); System.out.print(" "); } System.out.println(); } }
Comments
Awesome. Thank you
Leave a comment