dimanche 7 février 2016

Else condition seemingly fails to execute

I am creating a simple mathematics practice program, however I am running into a serious issue with my else conditions. When the conditions that should trigger the else block to run, the if statement runs instead. I have combed through each iteration of this if else series (this is only one of 5) for the last few hours, but I cannot figure what is occurring to prevent the else segment from running. correctrange / correctrange2 are random generated int values (currently they are always 7 & 6 respectively d1 & d2 are the same values as doubles human is an error parameter

boolean addition = false;
while(input1 == 'A'|| input1 == 'a')
{
    System.out.println("What is the solution to the problem " + correctRange 
                + " + " +  correctRange2 );
    if(userinput.nextDouble() <= (d1 + d2) + human || 
       userinput.nextDouble() >= (d1 + d2) - human)
    {System.out.println("That is correct!");
     System.out.println("What would you like to practice next?");
     addition = true;
    }
    while (addition = false) 
        {System.out.println("The correct solution is " +
                correctRange + correctRange2);
        input1 = 'q';
        }
    input1 = userinput.next().charAt(0);
   }

Aucun commentaire:

Enregistrer un commentaire