Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Composition to implement the following: Use Multiple Source file, Class Definition in header file, class implementation in .cpp file and application in separate .cpp

Use Composition to implement the following:

Use Multiple Source file, Class Definition in header file, class implementation in .cpp file and application in separate .cpp file. Not using these criterias will receive 0 for the points.

Design a TimeCard class that allows a company to pay a worker for a days 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 days 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 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 Pay Rate: $12.50 Hours worked: 8.50 Per hour, the day's earnings are: $106.25

Table format would be more usable.

Worker ID Start Time End Time Pay Rate Hours Worked Day's Earning 123456789 8:00:00 AM 3:30:00 PM $12.50 7.50 $ 93.75 997654321 8:00:00 AM 4:30:00 PM $12.50 8.50 $106.25

please do include every header file and guide to make this assignment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions