Question: a. Question 4 (17+7 Points) Part (1) Define a class with the following specification: The class name is Exam with three private data members: exam

a. Question 4 (17+7 Points) Part (1) Define a class with the following specification: The class name is Exam with three private data members: exam course code (String), exam score (double) for the student, and maximum exam score maxScore (double). b. Write a constructor that initializes all the data members of the class from its parameters. If maxScore is less than score, then set them to zero and print a message for this change. C. Provide an accessor (get) method and a mutator (set) method only for the score data member. Make sure that the new score in the set method does not exceed maxScore, otherwise leave the current value of score unchanged. d. Define a method called addBonus() that adds a given bonus score, as input parameter, to the student's score. If the new score after adding the bonus exceeded the maximum score, then set score to maxScore. e. Define a method called percentage() that returns the exam percentage out of 100. f. Define a method called displayExamDetails() to display on the screen exam details as in the following sample: Code: ITCS113 Score: 53.5 Max Score: Percentage: 60.0 89.167%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
