Question: In c++, Design a class call NumDays. The class's purpose is to store a value that represents a number of work hours and convert it

In c++, Design a class call NumDays. The class's purpose is to store a value that represents a number of work hours and convert it to a number of days. For eample, 8 hours would be converted to 1 day, 12 hours would be converted to 1.5 days, and 18 hours would be converted to 2.25 days. The class should have a constructor that accpets a number of hours, as well as member functions for storing and retrieving the hours and days. The Class should also have the following oerloaded operators: + When two NumDays objects are added together, the overloaded + operator should return the sum of the two objects' hours members - When one NumDays object is subtracted from another, the overloaded - operator should return the difference ofthe two objects' hours members. ++These operators should increment the number of hours stored in the object. When incremented, the number of days should be automatically recalculated. -- These operators should decrement the number of hours stored ina object. When decremented, the number of days should be automatically recalculated.

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!