I am also doing another programming assignment. this one is a multiple choice game. where it have three rounds.
round 1 is the addition round
round 2 is the subtraction round
round 3 is the division
my problem is the division round which is round 3. I have already figure out round 1 and 2, there is no problem there. the problem is round three
i have manage to got it to divide yes but not the way how it is supposed to work. you see, the numerator must always be divisible by the denominator at all time. what I am getting is that numerator is being divided by numbers that cannot into it. the numbers have to be randomly generated. what i mean is the: 11/6 or 25/7 which is not supposed to do. any help with be greatly appreciated on how i can get the codes to work like this 20/4 or 24/3 and so on. here is the codes that i have so far.
i=1;
while(i < 2)//this while loop is used to know how many time it will be iterating
{
if(i<2)
{
numerator = 1 + randobj.nextInt(25);
denominator = 2 + randobj.nextInt(8);
correctans = numerator / denominator;
incorrectans = 25 + randobj.nextInt(50);
if(numerator %2!=denominator)
{
System.out.println(playername+" round 3 "+ " level "+ i+" question "+ i + " you are required to math the letter to the correct answer");
System.out.println(playername+" please divide "+ numerator + " / "+ denominator);
System.out.println("A:"+correctans);
System.out.println("B:"+incorrectans);
choice = userinput.next().charAt(0);
if(choice == 'A' || choice == 'a')
{
System.out.println(playername+" awesome, you are correct, well done, keep up the good work");
score += score + 250;
System.out.println("round 3");
System.out.println("level "+ i);
score += score;
System.out.println("the total score is "+ totalscore);
correctans++;// to keep a count of all the correct answer
}
else if(choice == 'B' || choice == 'b')
{
System.out.println(playername+" ahhh bummer!!! that is not the correct answer, so sorry, give it another try");
score -= score - 125;
System.out.println("round 3");
System.out.println("level "+i);
totalscore -= score;
System.out.println("the total score is "+ totalscore);
i++;
}
}
}

