Design a class called NumDays. The class ‘s purpose is tostore a value that repr
ID: 3614575 • Letter: D
Question
Design a class called NumDays. The class ‘s purpose is tostore a value that represents a number of work hours and convert itto a number of days. For example, 8 hours would be converted to 1day, 12 hours would be converted to 1.5 days, and 18 hourswould be converted to 2.25 days. The class should have constructorthat accepts a number of hours, as well as member functions forstoring and retrieving the hours and days. The class should alsohave the following overloaded operators:
+ Addition operator: When two NumDays objects areadded together, the overloaded +
operator should return the sum ofthe two object’s hours member.
- Subtraction operator: When one NumDaysobject is subtracted from another, the
overloaded – operator should return the differenceof the two objects hours member.
++ Prefix and postfix increment operators. These operatorsshould increment the number
of hours stored in the object.When incremented, the number of days should be
automatically re-calculated.
-- Prefix and postfix increment operators. These operatorsshould decrement the number
of hours stored in the object.When decremented, the number of days should be
automatically re-calculated.
Explanation / Answer
yes that was very helpful thank you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.