Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please . change to nested for loop { public static String getlotteryticket1() { String lotteryTicket1 = ; // create random number generator Random lotteryNumbers1
Please . change to nested for loop
{ public static String getlotteryticket1() { String lotteryTicket1 = " "; // create random number generator Random lotteryNumbers1 = new Random(); // 5 lotto number int [] ticket1 = new int[5]; for( int count = 0; count < ticket1.length; ++count ) { ticket1[count] = (1 + lotteryNumbers1.nextInt(47) ); } Arrays.sort( ticket1 ); //add the element for(int count = 0; count < ticket1.length; ++count ) { lotteryTicket1 += ticket1[count]; lotteryTicket1 += " "; } //ticket lotteryTicket1 += "value: "; lotteryTicket1 += (1 + lotteryNumbers1.nextInt(27) ); lotteryTicket1 += " "; return lotteryTicket1; } public static void main( String [] args ) { int numberOfTickets1; System.out.print( "generate tickets " ); numberOfTickets1 = Integer.parseInt(JOptionPane.showInputDialog("Enter number of tickets")); // display the ticket for( int count = 1; count <= numberOfTickets1; ++count) { System.out.printf( "LOTTERY TICKET %d:", count ); System.out.print( getlotteryticket1() ); } System.out.print( " done" ); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started