Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ please Question Write a complete C++ program. The program uses various types of structured data developed to calculate the salary of each employee

using c++ please

image text in transcribedimage text in transcribedimage text in transcribed

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 to be paid for each department. The program should perform the following tasks: Task 1: Declare a structure named Employee, with the following members. a) Name b) Department c) Basic salary d) Number of overtime hours worked in one month e) Overtime pay 1) Total salary including overtime pay Task 2: Write a fimction named readInput. a) It receives an array of Employee of type struct. b) The fimction should read data from the given input file named input.txt. The file contains employees' department, basic salary, number of overtime hours worked in one month, and name. Figure 1 shows an example of data that can be used to test the program c) Assuming you do not know, the member of employees. Calculate the number of employees available in the company based on the number of employee records found in the input file. d) The function should return the mmber of employees calculated in (). Production 2500 27 Salman Als Quality 1800 45 Hanit Haikal Production 2000 53 Rashid Abu Production 1800 5 Halim Hashim Quality 2400 35 Rani Imran Engineering 2300 27 Arina Hakim Accounting 2500 36 Anuar Omar Quality 1900 33 Zarith aid Engineering 2350 52 Rania Hassan Engineering 2250 44 Bahari Burhan Quality 2250 38 Citra Shari Accounting 2250 36 ir Arshad Accounting 2180 41 Daud Kasim Engineering 2500 35 Sofian Saad Accounting 2450 29 Alisa Azman Figure 1: Sample data in the input file "input.txt" Task 3: Write a function named determineRate. 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 Department Quality Production Accounting Engineering Table 1 Overtime Rate (RM per hour) 11.5 10.0 12.5 15.0 Task 4: Write a fiction named displayOutput. 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 fimction 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 rare x Number of overtime hours worked Monthiy 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 () DE (HOURS OF PAY (10) SALARYCK Salman All Hanit kekal Rashid Abu Hall Hashim Hank Intan Arine Hakis Anuar Omar Zarith Zaid Rania Hassan Buhari Burhan citre Amix Arabe Daud Kasim Sofian Said Alias Azman Production Quality Production Production Quality Engineering Accounting Quality Ragineering Engineering Quality Accounting Accounting Regineering 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 45 53 58 35 27 36 33 52 44 38 36 41 35 270.00 517.50 530.00 580.00 402.50 405.00 450.00 379.50 780.00 660.00 437.00 450.00 $12.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 5: Write a function named displayAnalysis. a) This is a non-retuming 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 departments' names, total monthly overtime (OT) pays, and total monthly salary. d) Figure 3 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. 3 DEPARTMENE Production Quality ngineering Accounting Tor. OT VAY (2) 1380.00 1736.50 2370.00 1775.00 TOT. SALARY (4) 7680.00 10086.50 11770.00 11155.00 Figure 3: Expected output for Task 5 Task 6: Write a main fimction to perform the following tasks: a) Declare one-dimensional array variable with 50 elements for a structure type Employee b) The function may need to call the functions that are defined in the previous task to produce the output as shown in Figure 4. Note: Please use proper output formatting Figure 4 shows the complete output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. RANGE DEPARTMENT SALARY Salman All Hanit Haikal Baabid Aba Halla Hashim Hant Imran Arine Hali Anwar Omar Zarith Said Kania lassan Buhari Burhan citra shari Anit Arshad Daud Kasim Sofian Saad Alina Azman DEPARTMENT Production Quality Engineering Accounting Production Quality Production Production Quality Engineering Accounting Quality Bagineering Engineering Accounting Accounting Engineering Accounting BASIC (12) 7 (HOUR)O PAY (10) 2500.00 27 270.00 1800.00 45 $17.50 2000.00 53 530.00 1800.00 SB 580.00 2400.00 35 402.50 2300.00 27 405.00 2500.00 36 450.00 1900.00 33 379,50 2350.00 52 780.00 44 660.00 2250.00 38 437.00 2250.00 36 450.00 2180.00 512.50 2500.00 35 525.00 2450.00 29 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 2250.00 Quality OT. OT VAY() 1380.00 1736.50 2270.00 1775.00 TOT. SALARY (1) 7680.00 10086.50 11770.00 11155.00 Figure 4: Complete output for the data from the input file "input.txt" Task 7: List all fimction prototypes. Task 8: You must ensure you program fulfill the following criteria: a) The program is able to num. b) All required header files are included 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 to be paid for each department. The program should perform the following tasks: Task 1: Declare a structure named Employee, with the following members. a) Name b) Department c) Basic salary d) Number of overtime hours worked in one month e) Overtime pay 1) Total salary including overtime pay Task 2: Write a fimction named readInput. a) It receives an array of Employee of type struct. b) The fimction should read data from the given input file named input.txt. The file contains employees' department, basic salary, number of overtime hours worked in one month, and name. Figure 1 shows an example of data that can be used to test the program c) Assuming you do not know, the member of employees. Calculate the number of employees available in the company based on the number of employee records found in the input file. d) The function should return the mmber of employees calculated in (). Production 2500 27 Salman Als Quality 1800 45 Hanit Haikal Production 2000 53 Rashid Abu Production 1800 5 Halim Hashim Quality 2400 35 Rani Imran Engineering 2300 27 Arina Hakim Accounting 2500 36 Anuar Omar Quality 1900 33 Zarith aid Engineering 2350 52 Rania Hassan Engineering 2250 44 Bahari Burhan Quality 2250 38 Citra Shari Accounting 2250 36 ir Arshad Accounting 2180 41 Daud Kasim Engineering 2500 35 Sofian Saad Accounting 2450 29 Alisa Azman Figure 1: Sample data in the input file "input.txt" Task 3: Write a function named determineRate. 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 Department Quality Production Accounting Engineering Table 1 Overtime Rate (RM per hour) 11.5 10.0 12.5 15.0 Task 4: Write a fiction named displayOutput. 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 fimction 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 rare x Number of overtime hours worked Monthiy 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 () DE (HOURS OF PAY (10) SALARYCK Salman All Hanit kekal Rashid Abu Hall Hashim Hank Intan Arine Hakis Anuar Omar Zarith Zaid Rania Hassan Buhari Burhan citre Amix Arabe Daud Kasim Sofian Said Alias Azman Production Quality Production Production Quality Engineering Accounting Quality Ragineering Engineering Quality Accounting Accounting Regineering 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 45 53 58 35 27 36 33 52 44 38 36 41 35 270.00 517.50 530.00 580.00 402.50 405.00 450.00 379.50 780.00 660.00 437.00 450.00 $12.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 5: Write a function named displayAnalysis. a) This is a non-retuming 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 departments' names, total monthly overtime (OT) pays, and total monthly salary. d) Figure 3 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. 3 DEPARTMENE Production Quality ngineering Accounting Tor. OT VAY (2) 1380.00 1736.50 2370.00 1775.00 TOT. SALARY (4) 7680.00 10086.50 11770.00 11155.00 Figure 3: Expected output for Task 5 Task 6: Write a main fimction to perform the following tasks: a) Declare one-dimensional array variable with 50 elements for a structure type Employee b) The function may need to call the functions that are defined in the previous task to produce the output as shown in Figure 4. Note: Please use proper output formatting Figure 4 shows the complete output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. RANGE DEPARTMENT SALARY Salman All Hanit Haikal Baabid Aba Halla Hashim Hant Imran Arine Hali Anwar Omar Zarith Said Kania lassan Buhari Burhan citra shari Anit Arshad Daud Kasim Sofian Saad Alina Azman DEPARTMENT Production Quality Engineering Accounting Production Quality Production Production Quality Engineering Accounting Quality Bagineering Engineering Accounting Accounting Engineering Accounting BASIC (12) 7 (HOUR)O PAY (10) 2500.00 27 270.00 1800.00 45 $17.50 2000.00 53 530.00 1800.00 SB 580.00 2400.00 35 402.50 2300.00 27 405.00 2500.00 36 450.00 1900.00 33 379,50 2350.00 52 780.00 44 660.00 2250.00 38 437.00 2250.00 36 450.00 2180.00 512.50 2500.00 35 525.00 2450.00 29 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 2250.00 Quality OT. OT VAY() 1380.00 1736.50 2270.00 1775.00 TOT. SALARY (1) 7680.00 10086.50 11770.00 11155.00 Figure 4: Complete output for the data from the input file "input.txt" Task 7: List all fimction prototypes. Task 8: You must ensure you program fulfill the following criteria: a) The program is able to num. b) All required header files are included

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

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago

Question

describe the services that an outplacement consultancy may provide.

Answered: 1 week ago