All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Catherine Christopher wrote:I'm sorry for replying a little later than intended, but I'm happy to say that the issues in the code have finally been resolved. The code is finally running as its supposed to after fixing the problem with the boolean value and the do-while loop.
I didn't know that you shouldn't use an equals sign for a boolean because that assigns a value to them, not check its condition.
And if a value is assigned to them, it becomes permanent and can't change depending on the conditions meant to change it.
Apparently the error where the input on the first line when in a loop wasn't the code itself, but an error brought over from C++, and had to be avoided by adding in an extra scan.nextLine() after the command to prompt the user and assigning their input as the values of the name of the user and their which letters they chose.
But scan.next() didn't scan the entire name if there was a space between two names when I tried it, so it had to stay as scan.nextLine() in the end.
But other than that the code runs fine, thank you for all the help ^^
All things are lawful, but not all things are profitable.
Are you quite sure about that? I don't like continue; but other people are happy to use it. Should you get to that line 27, you will simply break out of the loop. The test will always faill because your boolean will be false. This suggests to me that you didn't need that boolean in the first place. The return; at the end of the method is redundant; the method would complete with or without return;Catherine Christopher wrote:. . . . . .
Thank youhere's an example you can use from.
Everybody's invited. Even this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|