I am a beginner Java student. This is the general idea of what I'm doing.
I have a list of things that a user can pick from by inputting the corresponding number. After they input ONE integer, the string next to the item prints as YES. If they decide they don't want it anymore, they have to input that same number again and then string is supposed to change to NO. My nested loop technique is allowing for this change, but changes it right back after reading the next if statement. I have been working on this for a very long time. Can anyone please nudge me in the right direction to identify this problem?
do
{
int num=input.nextInt();
if (num == 7)
{
if(s.equals("NO")) //corresponding string
{
s = "YES";
}
if(s.equals("YES")) //same corresponding string
{
s = "NO";
}
}
//similar if statements for different conditions
//similar if statements for different conditions
}while(myBoolean()==true);
if (something) {...} else if (something else) {...}Your code is missing theelseI think.