title: What is wrong with this simple Golf Game Java code?
body: <p>I'm lost. In my Java 1 class I'm supposed to debug this simple code and fix it. It's a simple Golf Game. I know this question is basically asking you guys too do my homework, but I want help getting pushed in the right direction for future debug assignments.</p>
  
  <p><strong>GolfGame.java</strong></p>
  
  <pre><code>import java.util.Scanner;
  
  /*
   * Debugging Exercise - Chapter 4
   *
   * Debug the error(s) and submit to the Dropbox on Angel
   * Please do not submit if it is not debugged
   *
   */
  
  ///////////////////////////////////////////////////////////////////////////////
  // READ ME FIRST:
  //   This program compiles, but, there is logic error in the while statement.
  //   Debug the logic error and run the program to calculate your golf score.
  //   Try inputting several numbers to get the total score.
  //   The program should keep looping until the user selects -1 to terminate.
  ///////////////////////////////////////////////////////////////////////////////
  
  public class GolfGame {
  
      Scanner input = new Scanner(System.in);
  
      public void getTotalScore() {
  
          int score = 0, total = 0;
  
          while ( score == -1 )
          {
              System.out.print("Please enter a score [-1 to quit]: ");
              score = input.nextInt();
              System.out.println();
              total += score;
          }
  
          if (total != -1)
              System.out.println("Your total score is " + total);
      }
  }
  </code></pre>
  
  <p><strong>GolfGameTest.java</strong></p>
  
  <pre><code>/*
   * This is the MAIN class; RUN this class to show
   * that the GolfGame.java program functions correctly.
   *
   * NOTE: You must first debug the GolfGame.java file.
   *       There is no need to debug this file.
   */
  public class GolfGameTest {
  
      public static void main(String[] args)
      {
          System.out.println("Golf Game Calculator");
          GolfGame golfGame = new GolfGame();
          golfGame.getTotalScore();
      }
  }
  </code></pre>