title: Trying to use a while or do while loop to run a basic math game with certain conditions
body: <p>The body of the code is supposed to run until the user has <strong>entered at least 10 questions</strong>, has <strong>not entered more than 20 questions</strong>, and until the student's <strong>percent correct is 85% or higher.</strong></p>
  
  <p>This is not the whole body but i think im having the most trouble with only the while loop. I have tried multiple combinations to get the code to run as stated above including the way i have given. I have tested all variables and they do keep track as the program runs but how can i get this code to run like the specifications say?</p>
  
  <p>So far i have this:</p>
  
  <pre><code>//Declaring int variables to store values of correct/wrong problems
      int numCorrect = 0;
      int numWrong = 0;
      int totalQuestions = 0;
      double percent = 0;
      int subNumCorrect = 0;
      int subNumWrong = 0;
      int addNumCorrect = 0;
      int addNumWrong = 0;
      //Storing the users answers as integers, after asking them for a          solution to a random problem
      //Then looping this code 20 times   
      while((totalQuestions &lt;= 5 &amp;&amp; percent &gt;= 85.0 || totalQuestions &lt; 10)) {
          Question theQuestion = new Question();
          Scanner scanner = new Scanner(System.in);
          System.out.println("What is the result?" + "\n" + theQuestion.toString());
          int result = scanner.nextInt();
  
          // Checks if the question is addition/subtraction and correct/wrong, then increases the variables 1 
  
          if((theQuestion.getOperator() == '+') &amp;&amp; (result == theQuestion.determineAnswer()))
              addNumCorrect += 1;
          else if(theQuestion.getOperator() == '+' &amp;&amp; (result != theQuestion.determineAnswer()))
              addNumWrong += 1;
  
          if((theQuestion.getOperator() == '-') &amp;&amp; (result == theQuestion.determineAnswer()))
              subNumCorrect += 1;
          else if((theQuestion.getOperator() == '-') &amp;&amp; (result != theQuestion.determineAnswer()))
              subNumWrong += 1;
  
          //Determines if the users answer is correct or not, and displays a message accordingly
          //As well as keeping count of how many correct/wrong answers are attempted by the user and storing them
          //in the variable numCorrect/numWrong
          if(result == theQuestion.determineAnswer()) {
              numCorrect += 1; 
              System.out.println("Congratulations, you got it correct!");
          }
          else if(result != theQuestion.determineAnswer()) {
              numWrong += 1;
              System.out.println("The correct answer for " + theQuestion.toString()
                  + " is " + theQuestion.determineAnswer());
  
          }
          //Increasing value of totalQuestions by one every loop
          totalQuestions++;
  
          //Multiplying the number of correct problems by 100 and dividing the product by the number of
          //total questions. Then rounding the quotient to get the percentage of correct answers
          percent = Math.round((double)(numCorrect * 100) / (totalQuestions));
      }
      //Progress report displaying how many addition and subtraction problems the user got correct and wrong
      //Then determines the percentage of correct problems the user entered
  
  
      System.out.println("\nProgress Report:" + "\nAddition:\nYou got " + addNumCorrect
          + " correct and " + addNumWrong + " incorrect.");
      System.out.println("Subtraction:\nYou got " + subNumCorrect
          + " correct and " + subNumWrong + " incorrect.");
      System.out.println("Number of problems: " + totalQuestions);
      System.out.println("The percent correct: " + percent + "%");
  
  }
  </code></pre>
  
  <p>}</p>