Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q3 Answer Q3(a)-Q3(e) based on the information given in Figure Q3. GradedActivity -score: double +set Score (s: double):void +get Score () : double +getGrade(): char
Q3 Answer Q3(a)-Q3(e) based on the information given in Figure Q3. GradedActivity -score: double +set Score (s: double):void +get Score () : double +getGrade(): char FinalExam -numQuestions:int -pointsEach:double -numMissed:int +FinalExam (questions:int, missed:int) +get Points(): double +getNumMissed(): int The above diagram shows the relationship between GradedActivity and FinalExam classes. The implementation of the set Score () method for the class GradedActivity is given as follows: public class GradedActivity { private double score; public void set Score (double s) { score = s; } } FIGURE Q3 (a) Write class header for FinalExam. (b) Declare data field(s) for FinalExam. (c) Write a constructor with argument(s) for FinalExam. The constructor shall fulfil the following requirements: The constructor accepts two arguments: the number of test questions on the exam, and the number of questions missed by a student. These values are assigned to the numQuestions and numMissed fields. The pointsEach field is assigned with 100.0 divided by numQuestions. Declare a variable called numericScore. Assign the result of the following calculation: 100.0 - (numMissed X pointsEach) to numericScore. Call set Score () method and pass the value of numericScore
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started