ScoreAnalyzer.java.html

  1  import java.util.Scanner;
  2  
  3  public class ScoreAnalyzer
  4  {
  5     public static void main(String[] args)
  6     {
  7        Scanner in = new Scanner(System.in);
  8        Student fred = new Student(100);
  9        System.out.println("Please enter values, Q to quit:");
 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     }
 20  }