can someone tell why am i getting loopin. trying to build this game and it is only looping
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String p1name, p2name;
int p1age, p2age, score, sum = 0;
int largest = 0, smallest = 0, levcomp, ans = 0;
int age = 0, i = 0, value, num = 0;
int mistakes0;
int mtakes = 0;
int numtries = 0;
int count = 1;
// required variables are entered here
Scanner userin = new Scanner (System.in);
Random randomgen = new Random();
System.out.println("Welcome Students, To the School of Hard Knocks!!!!!");
System.out.println("Today we are about to learn to count numbers ");
System.out.println("I am looking for two players to play a game of counting numbers, who is going to be the two players?");
System.out.println("K'Ionda, Lorraine, anyone, okay lets take K'Ionda and Lorraine to play ");
System.out.println("Lets see how good you both are at counting numbers");
System.out.println("The rules of the game are that both players must between the ages of 5 and 10");
System.out.println("The rules states that each players have a miinimum of three atempts");
System.out.println("The game will be forfeited if each players answer the three questions wrong");
System.out.println("If a player get three question wrong, the other player automatically wins the game");
System.out.println("The numbers are generated randomly, so the players will input the numbers from smallest to largest");
System.out.println("Another one also is from the largest to the smallest");
System.out.println("for every correct answer 15 points are given and for every wrong answer 5 points are deducted");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println(" ");
System.out.println("So ah guess you guys are ready to have some fun");
System.out.println("lets give a hearty round of applause for the two volunteers " + " clap!! clap!!");
System.out.println(" okay let's go!!!");
System.out.println(" ");
do
{
//if(age < 5 && age > 10)
System.out.println("p1 enter your name please");
p1name = userin.next();
System.out.println("p1 enter your age please");
p1age = userin.nextInt();
}
while(age < 5 || age > 10);
count++;
}
it has to loop in the sense if the player enter the wrong age where they can go back to re enter but it is not doing that. it is looping back to the name and age this is the output
Welcome Students, To the School of Hard Knocks!!!!!
Today we are about to learn to count numbers
I am looking for two players to play a game of counting numbers, who is going to be the two players?
K'Ionda, Lorraine, anyone, okay lets take K'Ionda and Lorraine to play
Lets see how good you both are at counting numbers
The rules of the game are that both players must between the ages of 5 and 10
The rules states that each players have a miinimum of three atempts
The game will be forfeited if each players answer the three questions wrong
If a player get three question wrong, the other player automatically wins the game
The numbers are generated randomly, so the players will input the numbers from smallest to largest
Another one also is from the largest to the smallest
for every correct answer 15 points are given and for every wrong answer 5 points are deducted
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So ah guess you guys are ready to have some fun
lets give a hearty round of applause for the two volunteers clap!! clap!!
okay let's go!!!
p1 enter your name please
h
p1 enter your age please
4
p1 enter your name please
l
p1 enter your age please
4
p1 enter your name please
l
p1 enter your age please
7
p1 enter your name please
BUILD STOPPED (total time: 24 seconds)
can someone help pla