Question: Define a struct called Work that has the components type of type string, hours of type integer, fee of type float for working for one
Define a struct called Work that has the components type of type string, hours of type
integer, fee of type float for working for one hour;
Define a class called Worker that has the private members name of type string,
numberOfJobs of type integer, a pointer of type Work, cost of type float, and findCost a
function to find the cost of all jobs. The class has the public members print a default
parametrized constructor, a destructor, and a copy constructor.
Overload the extraction operator, the insertion operator, the assignment operator,
and the preincrement operator as a member function of the class. The preincrement
operator adds to the numberOfJobs data member, so information of one more job should be
entered and the cost is recalculated.
Implement all functions of the class, enforcing the least privileged principle.
The following driver produces the given sample of input output:
Sample input output:
Omar Ali did jobs at a cost
Enter the job type, hours, and fee for jobs:
Carpting
Painting
Solering
Carpentering
Ali Omar did jobs at a cost
Enter one more job type, hours, and fee:
Glassing
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
