title: How to calculate average test score
body: <p>The homework problem is to write a program that adds together all the scores from a class exam and find the average. <br/></p>
  
  <p>I have two questions. To find the average, you have to divide the total score by the number of test takers. I don't know how to record how many test takers there are.<br/></p>
  
  <p>Does the method for getting the average go in the while loop or outside the while loop? </p>
  
  <pre><code>import acm.program.*;
  
  
  public class AvgScore extends ConsoleProgram {
     public void run(){
     println("This program averages the test scores of an exam until the SENTINEL is entered     ."); 
  
  
     int total = 0;
  
     while(true) {
         int score = readInt("enter the test score: ");
         if (score == SENTINEL) break;  
         total += score; 
              }
  
    println("the average for the class was");
  
      }
  
    private static final int SENTINEL = -1; 
  
    }
  </code></pre>