Please help me to write the program. Thank you very much foryour help. Write a p
ID: 3618398 • Letter: P
Question
Please help me to write the program. Thank you very much foryour help.Write a program SuperLotto that asks the user for how manyLotto tickets he wants. For each Lotto ticket, generate 5 randomnumbers 1-47 using the Random class. Then generate a random meganumber 1-27 and place it last. Create a static mathodgetLottoTicket that creates and returns one Lotto ticket as aString. Use an array to hold the first 5 Lotto numbers. Sort thearray using the Arrays.sort method. Print each Lotto ticket. Usethe command prompt for input and output. Please help me to write the program. Thank you very much foryour help.
Write a program SuperLotto that asks the user for how manyLotto tickets he wants. For each Lotto ticket, generate 5 randomnumbers 1-47 using the Random class. Then generate a random meganumber 1-27 and place it last. Create a static mathodgetLottoTicket that creates and returns one Lotto ticket as aString. Use an array to hold the first 5 Lotto numbers. Sort thearray using the Arrays.sort method. Print each Lotto ticket. Usethe command prompt for input and output.
Explanation / Answer
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; import java.util.Arrays; public class Main { public static void main(String[] args) { System.out.println("Enter how many lotto tickets you wants: "); BufferedReaderobjBufReader = new BufferedReader(newInputStreamReader(System.in)); int numTickets = 0; try { numTickets = Integer.parseInt(objBufReader.readLine()); String[] strTicketNumbers= getLottoTicket(numTickets); System.out.println("Your Looto Numbers : "); for(int i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.