Question: Write a complete C++ program. The program uses various types of structured data developed to calculate the salary of each employee and the total salary

Write a complete C++ program. The program uses various types of structured data developed to calculate the salary of each employee and the total salary to be paid for each department. The program should perform the following tasks:

Write a complete C++ program. The program uses various types of structured

input.txt:

Production 2500 27 Salman Ali Quality 1800 45 Hanif Haikal Production 2000 53 Rashid Abu Production 1800 58 Halim Hashim Quality 2400 35 Hani Imran Engineering 2300 27 Arina Hakim Accounting 2500 36 Anuar Omar Quality 1900 33 Zarith Zaid Engineering 2350 52 Rania Hassan Engineering 2250 44 Buhari Burhan Quality 2250 38 Citra Shari Accounting 2250 36 Amir Arshad Accounting 2180 41 Daud Kasim Engineering 2500 35 Sofian Saad Accounting 2450 29 Alisa Azman

Task 3: Write a function named determineRate. (6 marks) a) It takes the department name as an input parameter. b) The function should return an overtime rate based on the information given in Table 1. 2 Table 1 Overtime Rate (RM per hour) 11.5 Department Quality Production Accounting Engineering 10.0 12.5 15.0 Task 4: Write a function named displayOutput. (11 marks) a) This is a non-returning function. b) It takes an array of Employee of type struct and the number of employees calculated in Task 2 as input parameters. c) The function should display employees' names, department, basic salary, number of overtime (OT) hours worked in one month, monthly overtime (OT) pay, and monthly salary. The formula for calculating monthly overtime (OT) pay and monthly salary is as follows: Monthly overtime (OT) pay = Overtime rate x Number of overtime hours worked Monthly salary = Monthly overtime pay + Basic salary d) Figure 2 shows an example of the output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. NAME DEPARTMENT BASIC (RM) OT (HOUR) OT PAY (RM) SALARY (RM) Salman Ali Hanif Haikal Rashid Abu Halim Hashim Hani Imran Arina Hakim Anuar Omar Zarith Zaid Rania Hassan Buhari Burhan Citra Shari Amir Arshad Daud Kasim Sofian Saad Alisa Azman Production Quality Production Production Quality Engineering Accounting Quality Engineering Engineering Quality Accounting Accounting Engineering Accounting 2500.00 1800.00 2000.00 1800.00 2400.00 2300.00 2500.00 1900.00 2350.00 2250.00 2250.00 2250.00 2180.00 2500.00 2450.00 27 45 53 58 35 27 36 33 52 44 38 36 41 35 29 270.00 517.50 530.00 580.00 402.50 405.00 450.00 379.50 780.00 660.00 437.00 450.00 512.50 525.00 362.50 2770.00 2317.50 2530.00 2380.00 2802.50 2705.00 2950.00 2279.50 3130.00 2910.00 2687.00 2700.00 2692.50 3025.00 2812.50 Figure 2: Expected output for Task 4 Task 3: Write a function named determineRate. (6 marks) a) It takes the department name as an input parameter. b) The function should return an overtime rate based on the information given in Table 1. 2 Table 1 Overtime Rate (RM per hour) 11.5 Department Quality Production Accounting Engineering 10.0 12.5 15.0 Task 4: Write a function named displayOutput. (11 marks) a) This is a non-returning function. b) It takes an array of Employee of type struct and the number of employees calculated in Task 2 as input parameters. c) The function should display employees' names, department, basic salary, number of overtime (OT) hours worked in one month, monthly overtime (OT) pay, and monthly salary. The formula for calculating monthly overtime (OT) pay and monthly salary is as follows: Monthly overtime (OT) pay = Overtime rate x Number of overtime hours worked Monthly salary = Monthly overtime pay + Basic salary d) Figure 2 shows an example of the output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. NAME DEPARTMENT BASIC (RM) OT (HOUR) OT PAY (RM) SALARY (RM) Salman Ali Hanif Haikal Rashid Abu Halim Hashim Hani Imran Arina Hakim Anuar Omar Zarith Zaid Rania Hassan Buhari Burhan Citra Shari Amir Arshad Daud Kasim Sofian Saad Alisa Azman Production Quality Production Production Quality Engineering Accounting Quality Engineering Engineering Quality Accounting Accounting Engineering Accounting 2500.00 1800.00 2000.00 1800.00 2400.00 2300.00 2500.00 1900.00 2350.00 2250.00 2250.00 2250.00 2180.00 2500.00 2450.00 27 45 53 58 35 27 36 33 52 44 38 36 41 35 29 270.00 517.50 530.00 580.00 402.50 405.00 450.00 379.50 780.00 660.00 437.00 450.00 512.50 525.00 362.50 2770.00 2317.50 2530.00 2380.00 2802.50 2705.00 2950.00 2279.50 3130.00 2910.00 2687.00 2700.00 2692.50 3025.00 2812.50 Figure 2: Expected output for Task 4

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