Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

Students also viewed these Databases questions

Question

What processes are involved in perceiving?

Answered: 1 week ago