68 270
Assignments Done
99%
Successfully Done
In November 2018

Answer to Question #33428 in Java | JSP | JSF for Jimbo

Question #33428
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.
Expert's answer
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();
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
23.07.13, 15:02

<div>You're welcome. We are glad to be helpful.</div><div>If you really liked our service please press like-button beside answer field. Thank you!</div><div>
</div>

Jimbo
22.07.13, 19:18

Awesome. Thank you

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions