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; i20) { System.out.println("Invalid number. Please enter a value 1 through 20" + (array+1)); //page439 value=keyboard.nextInt(); } if(sequentialSearch(array,value,i)) { //assign value to array arry[i] = value; } else { System.out.println("You have already enetered that number, please enter another number"); i--; } } } //if user chooses no, randomly generate numbers for them else if(user == 2) { 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

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!