Help with Java code
I'm creating a game, but i have run into a problem.
[PHP]public class greatTextGame
{ public static void main(String args[])
{ boolean lifePts = true;
double life = 0;
int statCorrect = 0;
EasyReader easyreader = new EasyReader();
do
{ System.out.println("WHAT WILL BE YOUR QUESTER'S NAME?");
System.out.println("im here ");
String name = easyreader.readLine();
System.out.println("HOW MANY LIFE POINTS WILL YOU HAVE? (50-150)");
life = easyreader.readDouble();
if(life > 150 || life < 50)
{ lifePts = false;
}
/*C//C///*/ if(life == 3.14159265358979323)
/*/H//O//*/ { lifePts = true;
/*//E//D/*/ life = 999999999;
/*///A//E*/ System.out.println("Cheating? I thought you were better than that.");
/*////T//*/ System.out.println("Your life is now at 999999999 \n");
/*///////*/ }
while(lifePts == false)
{ System.out.println("PICK THE NUMBER OF LIFE POINTS THAT YOU WANT WITHIN THE RANGE OF 50-150.");
life = easyreader.readDouble();
/*C//C///*/ if(life == 3.14159265358979323)
/*/H//O//*/ { lifePts = true;
/*//E//D/*/ life = 999999999;
/*///A//E*/ System.out.println("Cheating? I thought you were better than that.");
/*////T//*/ System.out.println("Your life is now at 999999999 \n");
/*///////*/ }
else
{ if(life > 150 || life < 50)
{ lifePts = false;
}
else
{ lifePts = true;
}
}
}
System.out.println("YOUR NAME IS " + name + " AND YOU WILL HAVE " + life + " LIFE POINTS");
System.out.println("\nIF CORRECT, ENTER THE NUMBER 1. IF NOT, ENTER THE NUMBER 0.");
statCorrect = easyreader.readInt();
System.out.println(statCorrect);
}while(statCorrect != 1);
}
}[/PHP]
*note: easyreader is a way to take in user input.
If you run through the code and enter 0 to correct the info, it goes back to the beginning, but skips the first chance for input.
seen here:
![untitled.bmp](https://icrontic.com/uploads/2/5/7/5/5/24000.attach)
please help
[PHP]public class greatTextGame
{ public static void main(String args[])
{ boolean lifePts = true;
double life = 0;
int statCorrect = 0;
EasyReader easyreader = new EasyReader();
do
{ System.out.println("WHAT WILL BE YOUR QUESTER'S NAME?");
System.out.println("im here ");
String name = easyreader.readLine();
System.out.println("HOW MANY LIFE POINTS WILL YOU HAVE? (50-150)");
life = easyreader.readDouble();
if(life > 150 || life < 50)
{ lifePts = false;
}
/*C//C///*/ if(life == 3.14159265358979323)
/*/H//O//*/ { lifePts = true;
/*//E//D/*/ life = 999999999;
/*///A//E*/ System.out.println("Cheating? I thought you were better than that.");
/*////T//*/ System.out.println("Your life is now at 999999999 \n");
/*///////*/ }
while(lifePts == false)
{ System.out.println("PICK THE NUMBER OF LIFE POINTS THAT YOU WANT WITHIN THE RANGE OF 50-150.");
life = easyreader.readDouble();
/*C//C///*/ if(life == 3.14159265358979323)
/*/H//O//*/ { lifePts = true;
/*//E//D/*/ life = 999999999;
/*///A//E*/ System.out.println("Cheating? I thought you were better than that.");
/*////T//*/ System.out.println("Your life is now at 999999999 \n");
/*///////*/ }
else
{ if(life > 150 || life < 50)
{ lifePts = false;
}
else
{ lifePts = true;
}
}
}
System.out.println("YOUR NAME IS " + name + " AND YOU WILL HAVE " + life + " LIFE POINTS");
System.out.println("\nIF CORRECT, ENTER THE NUMBER 1. IF NOT, ENTER THE NUMBER 0.");
statCorrect = easyreader.readInt();
System.out.println(statCorrect);
}while(statCorrect != 1);
}
}[/PHP]
*note: easyreader is a way to take in user input.
If you run through the code and enter 0 to correct the info, it goes back to the beginning, but skips the first chance for input.
seen here:
please help
0
Comments
<code style="white-space: nowrap;"><code>{ boolean lifePts = true;
double life = 0;
int statCorrect = 0;
EasyReader easyreader = new EasyReader();
after your do then it'll reset the values each time.
</code></code>