Scores.java.html

  1  /**
  2     This program computes a final score for a series of quiz scores: the sum after dropping 
  3     the lowest score. The program adapts the algorithm for computing the minimum.
  4  */
  5  public class Scores
  6  {
  7     public static void main(String[] args)
  8     {
  9        Student fred = new Student();
 10        fred.readScores();
 11        int pos = fred.minimumPosition();
 12        if (pos == -1)
 13        {
 14           System.out.println("At least one score is required.");
 15        }
 16        else
 17        {
 18           fred.removeScore(pos);
 19           double total = fred.sum();
 20           System.out.println("Final score: " + total);
 21        }
 22     }
 23  }
 24