if wrong input, you get a new chance
Hey!
Just started java and was trying to create something.
The user is supposed to type in 6 numbers within a range from 1 - 64 . If the user types an invalid number, he will get a new shot. But all 64 numbers have to be correct, as they are going in to an array.
How would I implement that input system without making it to messy?
Thanks !
Re: if wrong input, you get a new chance
You have to make two checks: number is within the correct range and number is not already selected. Simple if statement handles the first problem. For the second use a loop to check all numbers selected so far against the new selected number. Place code to handle both (use of methods would be good) inside a loop that keeps going if either check fails.
Maybe I misinterpreted your post and the second (unique numbers) issue is not what you need.