Define a new "Exam" class that manages the exam name (string) and  its score (integer). For example, an exam can have   - "Midterm Exam", 100   - "Final Exam", 50  The class must not provide the default constructor. It must require the  exam name and score in order to initialize the Exam object.  The class must provide only the following methods (no more and no  less):  - isPerfect method that returns true if the score is exactly 100  and false otherwise.  - isPassing method that returns true if the score is equal or  greater than 70 and false otherwise.  - toString method must return all the exam information including  the result of the exam as a string in the following format:  EXAM() SCORE() RESULT(Pass/Fail)  such as EXAM(Midterm Exam) SCORE(100) RESULT(Pass)  EXAM(Final Exam) SCORE(50) RESULT(Fail)  "Pass" means the score is greater or equal 70.  "Fail" is whenever the score is below 70.  - isGreater method that compares with another Exam object and  return true if the score of the current Exam object is greater than  the score of the other Exam object.  - increment method that accepts the increment score amount  (int) and increase the current score of that exam by that given  amount    Important notes:  - Please do not provide any other method including a method  to return the score.  - The class must not provide the default constructor.    Show how this Exam class being used to create objects and how these  methods are being called and return proper values.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Define a new "Exam" class that manages the exam name (string) and 
its score (integer). For example, an exam can have 
 - "Midterm Exam", 100 
 - "Final Exam", 50 


The class must not provide the default constructor. It must require the 
exam name and score in order to initialize the Exam object. 

The class must provide only the following methods (no more and no 
less): 
isPerfect method that returns true if the score is exactly 100 
and false otherwise. 
- isPassing method that returns true if the score is equal or 
greater than 70 and false otherwise. 
toString method must return all the exam information including 
the result of the exam as a string in the following format: 
EXAM(<name>) SCORE(<score>) RESULT(Pass/Fail) 
such as
EXAM(Midterm Exam) SCORE(100) RESULT(Pass) 
EXAM(Final Exam) SCORE(50) RESULT(Fail) 
"Pass" means the score is greater or equal 70. 
"Fail" is whenever the score is below 70. 
isGreater method that compares with another Exam object and 
return true if the score of the current Exam object is greater than 
the score of the other Exam object. 
increment method that accepts the increment score amount 
(int) and increase the current score of that exam by that given 
amount 
 

Important notes: 
- Please do not provide any other method including a method 
to return the score. 
- The class must not provide the default constructor. 
 

Show how this Exam class being used to create objects and how these 
methods are being called and return proper values.

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning