ScoreTester.java.html

  1  import java.util.Scanner;
  2  
  3  public class ScoreTester
  4  {
  5     public static void main(String[] args)
  6     {
  7        Scanner in = new Scanner(System.in);
  8        double expected = in.nextDouble();
  9        Student fred = new Student(100);
 10        while (in.hasNextDouble())
 11        {  
 12           if (!fred.addScore(in.nextDouble()))
 13           {
 14              System.out.println("Too many scores.");
 15              return;
 16           }
 17        }
 18        System.out.println("Final score: " + fred.finalScore());
 19        System.out.println("Expected: " + expected);
 20     }
 21  }