Question: #include using namespace std; class TimeCard { public: TimeCard(double workingHours = 0.0, double vacationHours = 0.0); void Print() const; TimeCard operator-(double rhs); TimeCard operator-(TimeCard rhs);

 #include using namespace std; class TimeCard { public: TimeCard(double workingHours =

#include using namespace std;

class TimeCard { public: TimeCard(double workingHours = 0.0, double vacationHours = 0.0); void Print() const; TimeCard operator-(double rhs); TimeCard operator-(TimeCard rhs); private: double hoursWorked; double hoursOff; };

TimeCard::TimeCard(double workingHours, double vacationHours) { hoursWorked = workingHours; hoursOff = vacationHours; }

// No need to accommodate for overflow or negative values

/* Your code goes here */

void TimeCard::Print() const { cout

int main() { double workingHours1; double vacationHours1; double workingHours2; double vacationHours2; cin >> workingHours1; cin >> vacationHours1; cin >> workingHours2; cin >> vacationHours2; TimeCard timeCard1(workingHours1, vacationHours1); TimeCard timeCard2(workingHours2, vacationHours2); TimeCard difference1 = timeCard1 - workingHours2; TimeCard difference2 = timeCard1 - timeCard2; timeCard1.Print(); cout 450928.2561122.qx3zqy7 Jump to level 1 Four doubles are read from input, where the first two doubles are the hours worked and hours off of timeCard1 and the second two doubles are the hours worked and hours off of timeCard2. Define two functions to overload the - operator. The first function overloads the - operator to subtract a time card and a double representing the number of hours worked. The second function overloads the - operator to subtract two time cards. Ex: If the input is 10.010.08.08.0, then the output is: 10 hours worked, 10 hours off 8 hours worked Difference: 2 hours worked, 10 hours off 10 hours worked, 10 hours off 8 hours worked, 8 hours off Difference: 2 hours worked, 2 hours off Note: The difference of a time card and a double representing the number of hours worked is: - the difference of the number of hours worked and the double - the number of hours off is unchanged Note: The difference of two time cards is: - the difference of the number of hours worked - the difference of the number of hours off 1 2

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!