import java.io.*; 
  
public class KeepingScoreBoolean 
{ 
  static boolean additionProblem(int topNumber, int bottomNumber) throws Exception 
  { 
    boolean result = false; // assume answer will be wrong 
  
    BufferedReader cin; 
    cin = new BufferedReader(new InputStreamReader(System.in)); 
  
    int userAnswer; 
    System.out.print("\n\n\n      " + topNumber + " + " + bottomNumber + " = "); 
    userAnswer = new Double(cin.readLine()).intValue(); 
  
    int theAnswer = topNumber + bottomNumber; 
    if (theAnswer == userAnswer) 
    { 
      System.out.println("      Correct!"); 
      result = true; // answer is right! 
    } // if 
    else 
      System.out.println("      Very good, but a better answer is " + theAnswer); 
  
    return result; 
  } // additionProblem 
  
  public static void main(String[] argv) throws Exception 
  { 
    int score = 0; 
    if (additionProblem((int)(10 * Math.random()), (int)(10 * Math.random()))) 
      score++; 
    if (additionProblem((int)(10 * Math.random()), (int)(10 * Math.random()))) 
      score++; 
    if (additionProblem((int)(10 * Math.random()), (int)(10 * Math.random()))) 
      score++; 
    if (additionProblem((int)(10 * Math.random()), (int)(10 * Math.random()))) 
      score++; 
    if (additionProblem((int)(10 * Math.random()), (int)(10 * Math.random()))) 
      score++; 
  
    System.out.println("\n      TOTAL SCORE: " + score + " out of 5"); 
  } // main 
} // public class 
