hi i am building my final project
tell me why it is skipping the whole round two and why is it giving me zero to divide it is not supposed to random any zero at all here is my code
if(playerage < 8 )
{
System.out.println(playername+" you are too young for this game");
System.exit(0);
}
else if( playerage > 13)
{
System.out.println(playername+" you are to old for this game");
System.exit(0);
}
else if(playerage >= 8 && playerage <= 13)//round 1
{
System.out.println("\n***************round 1**********************\n");
System.out.println("\n this round is the addition round");
while( i<4 && wrongcount < 4)
{
//get the random numbers
i++;
intvalue = 1 + randobj.nextInt(25);
intvalue2 = 1 + randobj.nextInt(9);
correct_ans = intvalue + intvalue2;
incorrect_ans = 1 + randobj.nextInt(35);
while(correct_ans == incorrect_ans)
{
incorrect_ans = 1 + randobj.nextInt(35);
}
//indicating to the user where she would be starting from and what level
System.out.println(playername+" you are on round 1 "+ " level "+ i + " match the letter with the correct answer");
System.out.println(playername+" please add "+ intvalue + " + "+intvalue2);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
if(uSelect == 'A'|| uSelect == 'a')
{
System.out.println(playername+" well done kiddoo!! excellent keep up the good work");
totalscore += 350;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore += score;
System.out.println("total score "+ totalscore);
}
else
{
while(uSelect != 'A'&& uSelect != 'a' && wrongcount < 4)
{
System.out.println(playername+" okay let me catch my breath here, answer is incorrect, try again");
score -= 175;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore -= score;
System.out.println("total score: "+ totalscore);
wrongcount++;
if(wrongcount < 4)
{
System.out.println(playername+" you are still on round 1 "+" level "+ i +" match the letter with the correct ansswer");
System.out.println(playername+" please add "+ intvalue + " + "+ intvalue2);
System.out.println("A:"+ correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
}
/*if(uSelect == 'A'|| uSelect == 'a')
{
System.out.println(playername+" yah, good job, keep it up, answer is correct");
score += 350;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore =score;
System.out.println("total score: "+ totalscore);
}
else
{
System.out.println(playername+" no man, come on, you can do better than that, it wrong");
score -= 175;
System.out.println("round 1");
System.out.println("level "+ i);
totalscore =score;
System.out.println("total score: "+ totalscore);
wrongcount++;
}*/
}
}
}
System.out.println("\n*********************welcome to round 2*******************************\n");
System.out.println("\n this is the substraction round");
int num = 0;
while(i>=5 && i<=8 && wrongcount <4)
{
i++;
//get random numbers
largest = 1 + randobj.nextInt(25);
smallest = 1 + randobj.nextInt(9);
correct_ans = largest - smallest;
incorrect_ans = 1 + randobj.nextInt(35);
while(correct_ans == incorrect_ans)
{
incorrect_ans = 1 + randobj.nextInt(35);
}
if(i == 1)
{
//getting the largest and smallest number
largest = num1;
smallest = num2;
}
else
{
if(num1 > largest)
{
largest = num1;
}
if(num2 > smallest)
{
smallest = num2;
}
}
//indicate the round and level would be starting from
System.out.println(playername+" round 2 "+" level "+ i +" match the letter with the correct answer");
System.out.println(playername+" please subtract "+ largest + " - "+smallest);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
if(uSelect == 'A' || uSelect == 'a')
{
System.out.println(playername+"");
totalscore +=350;
System.out.println("round 2");
System.out.println("level "+i);
totalscore +=score;
System.out.println("total score it"+totalscore);
}
else
{
while(uSelect != 'A' && uSelect != 'a' & wrongcount < 4)
{
System.out.println(playername+" awww come on now wrong answer, let's do this again ");
totalscore -=175;
System.out.println("round 2");
System.out.println("level "+ i);
totalscore -=score;
System.out.println("total score:"+totalscore);
if(wrongcount <4)
{
System.out.println(playername+" round 2 "+ "level "+ i+" match the letter with the correct answer");
System.out.println(playername+" please subtract "+ largest + " - "+ smallest);
System.out.println("A:"+correct_ans);
System.out.println("B:"+incorrect_ans);
uSelect = reader.next().charAt(0);
}
}
}
}
System.out.println("\n*******************welcome to round 3*****************************");
System.out.println("\n this round is the division round");
while(i>=9 && i<=10 && wrongcount < 4)
{
i++;
//get random numbers
numerator = 1 + randobj.nextInt(25);
denominator = 2 + randobj.nextInt(9);
rand = 1 + randobj.nextInt(25);
rand2 = 2 + randobj.nextInt(9);
correct_ans = numerator = denominator * rand2;
correct_ans = numerator / denominator;
incorrect_ans = 1 + randobj.nextInt(35);
while(correct_ans == incorrect_ans)
{
incorrect_ans = 1 + randobj.nextInt(35);
}
System.out.println(playername+" you are on round 3 "+" level "+ i + " match the letter with the correct answer");
System.out.println(playername+" please divide "+ numerator + " / "+ denominator);
System.out.println("A:"+incorrect_ans);
System.out.println("B:"+correct_ans);
uSelect = reader.next().charAt(0);
if(uSelect == 'A' || uSelect == 'a')
{
System.out.println(playername+" hey that's great, correct is right, keep up the good worl");
totalscore +=350;
System.out.println("round 3");
System.out.println("level "+i);
totalscore +=score;
System.out.println("total score:"+totalscore);
}
else
{
while(uSelect !='A' && uSelect !='a' && wrongcount < 4)
{
System.out.println(playername+" tsk, tsk, nice bangbang!!! that is wrong, please try again, kiddooo!!!");
totalscore -=175;
System.out.println("round 3");
System.out.println("level "+ i);
totalscore -=score;
System.out.println("total score: "+totalscore);
}
}
}
while(wrongcount < 4)
{
System.out.println(playername+" you are on round 3 "+ " level "+ i + " match the letter with the correct answer");
System.out.println(playername+" please divide "+ numerator + " / "+ denominator);
System.out.println("A:"+incorrect_ans);
System.out.println("B:"+correct_ans);
uSelect = reader.next().charAt(0);
}
}
else
{
System.out.println(playername+"that is not a valid age");
}
System.out.println("the winner is "+playername);
System.out.println("the total score of the game is "+totalscore);
System.out.println("the level that the player was on is"+ "level "+i);
System.out.println("the number of chance left is"+wrongcount);
}
}

