Lotto program for intro to programing final
I have my program working except for one part.
I have to determine if 2 of the 3 random generated numbers match 2 of the 3 user input numbers.
I have copied in just that part of the code and not the whole program.
What happen if I have just one number match it says that 2 do.
Any help would be appreciated.
Thanks
Code Java:
else if (lotteryDigit1 == guess1
|| lotteryDigit1 == guess2
|| lotteryDigit1 == guess3
&& lotteryDigit2 == guess1
|| lotteryDigit2 == guess2
|| lotteryDigit2 == guess3
&& lotteryDigit3 == guess1
|| lotteryDigit3 == guess2
|| lotteryDigit3 == guess3)
System.out.println("Two numbers match: you win $1,000");
Re: Lotto program for intro to programing final
Quote:
What happen if I have just one number match it says that 2 do.
Looks like you are testing for three matching numbers and printing "Two numbers match"