Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A pet shop named OwnAPet wants to have a computerized system to calculate and print payroll information for its 5 employees. INSTRUCTIONS: Write a C++

A pet shop named OwnAPet wants to have a computerized system to calculate and print payroll information for its 5 employees. INSTRUCTIONS: Write a C++ payroll program for the pet shop owner. Your program should be able to do the following tasks: (a) The program should define two arrays: A ID array which is used to store the list of employee IDs. A 2D array which consists of four columns. The first column is used to store the list of hours worked, second column for storing the list of rates of pay, third column is for storing the list of regular pays, the fourth column for storing the list of overtime pays and the fifth column is for storing the list of total pays. (b) The program will read the data of the employees consisting of the employee IDs, hours worked and rates of pay from the keyboard. (c) The program will display the payroll information of the employees onto the screen. (d) Besides function main(), the program needs to define four (4) other functions as described in Table 4. You should use appropriate arguments (based on Table 4) for each function. (e) Figure 3 shows an example run of the program with the keyboard inputs whereas Table 5 shows the assessment criteria. Table 4: Description for functions Function Description displayLine() To display lines using 105 characters of onto the screen using a loop. getData() To get the data of the employees from the keyboard. For each employee, the user needs to enter the ID, hours worked and the rate of pay of the employee. The function should accept a ID array of emplD and 2D array empRecord as its arguments. calculatePayroll () To calculate the regular pays, overtime pays and total pays of the employees. For each employee, the calculation is done as follows: i) Regular pay = hour x rate ii) The overtime will be given if the employee hours worked exceeds 40 hours and calculated based on: Overtime = exceed hours x 1.5 x rate iii) Total pay = regular pay + overtime printData() The function should accept a 1D array of emplD and 2D array empRecord as its arguments. To print the payroll information of the employees onto the screen. The function should accept a 1D array of emplD and 2D array empRecord as its arguments. To search for the employee who has the highest overtime pay. The function should display the highest overtime pay, employee ID and the employee overtime pay onto the screen. highestOvertime () The function should accept a 1D array of emplD and 2D array empRecord as its arguments Payroll Program ID: 1 Hours worked: 45 Rate of Pay (RM per hour) : 3 ID: 2 Hours worked: 40 Rate of Pay (RM per hour) : 2 ID: 3 Hours worked: 20 Rate of Pay (RM per hour) : 1 ID: 4 Hours worked:55 Rate of Pay (RM per hour) :3 ID: 5 Hours worked: 41 Rate of Pay (RM per hour): 2 Payroll Final Report ID HOURS RATE (RM) REGULAR PAY (RM) OVERTIME (RM) TOTAL (RM) 1 2 3 4 5 WNPH 45 40 20 55 41 N 3 2 1 3 2 120 80 20 120 80 22.5 0 0 67.5 3 142.5 80 20 187.5 83 Staff 5 have the highest pay overtime of RM67.5 Press any key to continue Figure 3: Example run on screen

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

4. How do you ask for specific action in a courteous manner?

Answered: 1 week ago