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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education