Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Use Composition: Design a TimeCard class that allows a company to pay a work

ID: 3772609 • Letter: C

Question

C++
Use Composition:   

Design a TimeCard class that allows a company to pay a worker for a day’s labor.
The worker uses the time card to punch in at the beginning of the day and punch out upon quitting.
The company immediately pays the worker based on the hourly rate and the length of time on the job.
Use composition and incorporate the Time2 class to keep track of the
punchInTime (start time) and punchOutTime (end time) in the TimeCard class.

Use the following fields as private data for the Time2:
private int hour;
private int minute;
private int second;
Create all the appropriate method and constructors, with validation criteria.

Use the following fields as private data for the TimeCard:

Use the following fields as private data for the TimeCard:

private string workerID; // SS Number
private Time2 punchInTime, punchOutTime; // Time2 objects
private double payrate; // hourly pay
private bool hasPunched; // set to true after worker punches out

Write a test program that will create a punchInTime object and a punchOutTime object.
The class TimeCard should have member function(s) to calculate the duration (hours worked)
and calculate and print the day’s earnings.

Assume no worker punches in before 8:00 AM and no worker punches out after 5:00 PM (17.00).

Sample Input/Output:

Worker ID: 123456789
Start Time: 8:00:00 AM
End Time: 3:30:00 PM
At Pay Rate: $12.50
Hours worked: $7.50
Per hour, the day's earnings are: 93.75

Worker ID: 997654321
Start Time: 8:00:00 AM
End Time: 4:30:00 PM
At Pay Rate: $12.50
Hours worked: $8.50
Per hour, the day's earnings are: 106.25

Explanation / Answer

PROGRAM:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote