JAVA PROGRAM WITH ARRAYS : third time i post this, always wrong answers!! please
ID: 3693377 • Letter: J
Question
JAVA PROGRAM WITH ARRAYS :
third time i post this, always wrong answers!! please include program output sample!
You will creat a JAVA program that simulates the game of lotto using ARRAYS.
How does this work? the user will input 6 numbers (integers), ranging from 1 to 59.
the computer willl randomly pick the winning numbers (6 of them and the "Bonus" number)
in order to win first prize the user must match all of the 6 numbers.
in order to win second prize, the user will must match all of the 6 numbers AND the bonus number.
numbers CANNOT be generated twice, for example 6,18,18,50,52,55 is not valid as 18 appears twice.
winning numbers (via the computer) are always presented in ascending order.
include data validation and echo user input.
ARRAYS must be used in this program.
Explanation / Answer
import java.io.*; class Test{ public static void main(String[] args) throws IOException { int[] users = new int[6]; int[] comps = new int[6]; int bonus; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter 6 numbers from 1 to 59"); for(int i=0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.