Question: C++ Please. Design a class called DaysWorked. The class's purpose is to store a value mHours that could be evaluated in terms of days of

C++ Please. Design a class called DaysWorked. The class's purpose is tostore a value mHours that could be evaluated in terms of daysC++ Please.

Design a class called DaysWorked. The class's purpose is to store a value mHours that could be evaluated in terms of days of work. For example: - 8 hours are actually 1 day of work - 12 hours are 1.5 days of work - 18 hours are 2.25 days of work The class should have a default constructor, and an overloaded constructor that accepts a number of hours. The class should also have the following overloaded operators: - + The addition operator: When two Daysworked objects are added together, this operator should return a new object that has mHours equal to the sum of the two objects' mHours. - - The subtraction operator: When two DaysWorked objects are subtracted, this operator should return a new object that has mHours equal to the difference between the two objects' mHours. - ++ Prefix and postfix increment operators: These operators should increment the number of hours in the object. When incremented, the number of days of work should be recomputed. - - Prefix and postfix decrement operators: These operators should decrease the number of hours in the object. When decremented, the number of days of work should be recomputed. - > cin stream extraction operator: This operator should prompt the user to enter all the object's data in a clear fashion. - = = equality comparison operator: This operator should return true if both objects have equal mHours member variables [] subscript operator: This operator should return days if subscript is 0 , hours if subscript is 1 , and error out a message otherwise. The below driver program should display the following output

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!