title: How do i keep track of correct answers?
body: <pre><code>public static void main(String[] args) {
      Scanner Keyboard = new Scanner(System.in);
      System.out.println("Enter your name: ");
      String firstname =Keyboard.nextLine();
      System.out.println("Welcome "+ firstname+  "!"+ " Please answer the following questions:");
      int x =  (int)(20 * Math.random()) + 1;
      int y =  (int)(20 * Math.random()) + 1;
  
      int sum = (x+y);
      System.out.println(x + " + " + y + " = ");
      String sInput = Keyboard.nextLine();
      int answer1 = Integer.parseInt(sInput);
      if (answer1 ==sum){
          System.out.println("Correct!");
      }else{
      System.out.println("Wrong!");
      }
      System.out.println("The correct answer is " +sum);
  </code></pre>
  
  <p>I have no clue on how to keep track of the correct answers. I need something to keep track of when it prints correct. I don't know what to do though. I know I just need to record the corrects and divide by four. Four because thats how many questions I have in my quiz.</p>