Question: Introduction to java in NetBean. Basic programing using loops Scenario It is Saturday night, and you are watching the Lottery draw for Fantasy Five. You

Introduction to java in NetBean. Basic programing using loops

Scenario It is Saturday night, and you are watching the Lottery draw for Fantasy Five. You get inspired to write a program to generate 10 lotto tickets, each ticket has 5 Lotto numbers. What loop should you use, and why? Note: To generate the 5 lotto numbers, you could create another loop inside the outer loop. This is called a nested loop. Otherwise, you will have to duplicate the method to generate a random number 5 times.

Here is a tip for doing it: Inside the inner loop that generates the lotto numbers, one at a time in a loop, type: lottoNum = myRan.nextInt(60) + 1; lottoTicket = lottoTicket + " " + lottonNum; This means that as often as you generate a lotto num, you will concatenate it to a String of previously generated lotto numbers.

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 Databases Questions!