/** 
   This class determines the grade for a final exam. The numeric score is 
   rounded up to the next whole number if its fractional part is .5 or greater.
*/

public class FinalExam2 extends GradedActivity2
{
   private int numQuestions;  // Number of questions
   private double pointsEach; // Points for each question
   private int numMissed;     // Number of questions missed

   /**
      The constructor sets the number of questions on the exam and the number
      of questions missed.
      @param questions The number of questions.
      @param missed The number of questions missed.
   */
   public FinalExam2(int questions, int missed)
   {
      double numericScore;  // To hold a numeric score

      // Set the numQuestions and numMissed fields.
      numQuestions = questions;
      numMissed = missed;

      // Calculate points for each question and numeric score for this exam.
      pointsEach = 100.0 / questions;
      numericScore = 100.0 - (missed * pointsEach);

      // Call the inherited setScore method to set the numeric score.
      setScore(numericScore);
      
      // Adjust the score.
      adjustScore();
   } // end constructor


   /**
      The getPointsEach method returns the number of points each question is worth.
      @return The value in the pointsEach field.
   */
   public double getPointsEach()
   {
      return pointsEach;
   } // end getPointsEach

   /**
      The getNumMissed method returns the number of questions missed.
      @return The value in the numMissed field.
   */
   public int getNumMissed()
   {
      return numMissed;
   } // END getNumMissed

} // END CLASS
