ArrayList

Write a class named APExam that includes the properties mySubject (a String that represents a subject like "Physics" or "Calculus") & myScore (an integer between or including 1 and 5). This class should include all appropriate accessors and modifiers as well as a default constructor and an "other" constructor that accepts parameters. The default constructor should initialize myScore to 1 and mySubject to "". Include compareTo, equals, & toString methods to this class as well.

Write a class named APStudent that includes the properties myFirstName and myLastName as well as as a property named myExams that is an ArrayList of all APExam's taken by the student. This class must have a default constructor as well as a constructor that accepts the first and last names as parameters. It should also include accessor and modifier methods for both name properties as well as an accessor method for myExams. Also, the class must include the following methods

  • addExam - adds an APExam object to myExams
  • computeExamAverage - returns the student's average score on all exams
  • findHighestExamScore - returns the highest exam score that the student has earned
  • numberOfFives - returns the number of scores that were a 5.

Write a client program named ArrayListTest that uses Scanner to allow the user to enter a student's first and last names as well as AP exam subjects & scores (in that order). When the user is prompted to enter AP exam subjects, he/she must be told to input the sentinel value "end" to indicate that he/she has no more exam subjects or scores to input. Do not require him/her to enter a score just after he/she entered the sentinel value "end". The program must then use the appropriate APStudent methods to compute and display the student's average exam score, the highest exam score, and the number of scores that were a 5.

You may want to use this ArrayListDemo1 as a model for this assignment.

Your program must follow our class Coding Standards.

Preconditions:

    • The user will input valid exam scores between or including 1 and 5.

You must hand in the following on separate pages stapled in this specified order:

    1. The source code for the APExam class.
    2. The source code for the APStudent class.
    3. The source code for ArrayListTest
    4. The screen capture of your program's output with several different exams and scores.