Question: /** This program allows the user to play the lottery by entering a ticket to compare to the computer generated winning lottery ticket */ import
/** This program allows the user to play the lottery by entering a ticket to compare to the computer generated winning lottery ticket */ import java.util.Scanner; import java.util.Random; import java.io.*;
public class Lottery { public static void main (String[] args) throws IOException { int[] l= new int[5]; int[] w= new int[5]; l=lottery(); w=winning(); m=match(l,w); d=display(); } public static int[] lottery() { int[] array = new int[5]; int value; Scanner keyboard = new Scanner(System.in); Random randomNumbers = new Random(); //Ask the user if they would like to pick their own numbers System.out.println("Would you like to enter your own lottery numbers? Select 1 for yes or select 2 for no"); int user = keyboard.nextInt(); //validate user input while(user<1 || user>2) { System.out.println("Invalid number. Please enter 1 for yes or 2 for no"); user = keyboard.nextInt(); } //if user selects yes, allow them to enter their own numbers if (user == 1) { //Get the lottery numbers from user for (int i=0; i //create empty array to store the values that get repeated } I am getting many error messages when I try to compile this code and I do not know how to fix them. Please use java to make corrections.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
