Question: C++ Define a new Degree class that contains a subject (string), the graduation year (integer), and the boolean flag indicating whether this is

C++

Define a new "Degree" class that contains a subject (string), the graduation year (integer), and the boolean flag indicating whether this is a graduation with distinction or not (cum laude)

For example, here is a degree object: - "Computer Science", 2023 and cumlaude (true)

It should have at least the following three methods: "toString" method must return all the certificate information as a string in the following format: DEGREE() GRADUATION-YEAR() DISTINCTION() such as DEGREE(Computer Science) GRADUATION-YEAR(2023) DISTINCTION(yes) or DEGREE(Biology) GRADUATION-YEAR(2022) DISTINCTION(no)

"isSame" method that compares with another Degree object and return true only if the two degrees have the same subject and same year.

"hasError" method that return true if the subject is empty or the year is negative or greater than 2023. It returns false otherwise.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!