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, p 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 pre-increment operator ++ as a member function of the class. The pre-increment
operator adds 1 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 3 jobs at a cost 600
Enter the job type, hours, and fee for 4 jobs:
Carpting 320.5
Painting 725.0
Solering 135.0
Carpentering 235.5
Ali Omar did 4 jobs at a cost 342.5
Enter one more job type, hours, and fee:
Glassing 450.0
Define a struct called Work that has the

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 Programming Questions!