Re: Else-if statment failure
Won't work in what way? nothing is printed? don't get the desired results? what are the desired results?
Re: Else-if statment failure
Quote:
Originally Posted by
newbie
Won't work in what way? nothing is printed? don't get the desired results? what are the desired results?
Ok, this code here:
Code :
if (WinnerPoints > 5)
System.out.println("Begin Test..");
else if (WinnerPoints == 0)
System.out.println("Good Bye");
Is supposed to print out: "Begin Test" if you have 5 WinnerPoints, but if you have 0, it is supposed to say "Good Bye" but this whole statement isn't being recognized by the program.
Re: Else-if statment failure
Because the condition is, if WinnerPoints is GREATER than 5; print message.
WinnerPoints can never exceed 5 in your program.
Re: Else-if statment failure
Quote:
Originally Posted by
newbie
Because the condition is, if WinnerPoints is GREATER than 5; print message.
WinnerPoints can never exceed 5 in your program.
Ohh I see, but I fixed it another way, just put a System.exit command under the losing numbers,
Re: Else-if statment failure
System.exit isn't the best approach to take, easier and better to change the condition to equal to or greater than.
Re: Else-if statment failure
Quote:
Originally Posted by
newbie
System.exit isn't the best approach to take, easier and better to change the condition to equal to or greater than.
Ok, thanks for the help, I will go back and make it run smoother once I finish my project.