Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

QUESTION 2 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: g) Name h) Department i) Basic salary j) Number of overtime hours worked in one month k) Overtime pay 1) Total salary including overtime pay Dr Eiliyah Wong Task 2: Write a function named readinput. a) It receives an array of Employee of type struct. b) The function should read the data from the input text file named input.txt. The file contains employees' names, department, basic salary, and number of overtime hours worked in one month. Figure 5 shows an example of data that can be used to test the program. \begin{tabular}{l} Salman Ali,Production, 250027 \\ Hanif Haikal, Quality, 180045 \\ Rashid Abu, Production, 200053 \\ Halim Hashim, Production, 180058 \\ Hani Imran, Quality, 240035 \\ Arina Hakim, Engineering, 230027 \\ Anuar Omar, Accounting, 250036 \\ Zarith Zaid, Quality, 190033 \\ Rania Hassan, Engineering, 235052 \\ Buhari Burhan, Engineering, 225044 \\ Citra Shari,Quality, 225038 \\ Amir Arshad, Accounting, 225036 \\ Daud Kasim,Accounting, 218041 \\ Sofian Saad, Engineering, 250035 \\ Alisa Azman, Accounting, 245029 \\ \hline \end{tabular} Figure 5: Sample data in the input file "input. txt" c) Assuming you do not know, the number 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 number of employees calculated in (c). Task 3: Write a function named determineRate. e) It takes the department name as an input parameter. f) The function should return an overtime rate based on the information given in Table 2. Task 4: Write a function named displayoutput. e) This is a non-returning function. f) It takes an array of Employee of type struct and the number of employees calculated in Task 2 as input parameters. Dr Eiliyah Wong g) The function should display employees' names, department, basic salary, number of overtime hours worked in one month, monthly overtime pays, and monthly salary. The formula for calculating monthly overtime pay and monthly salary is as follows: Monthly overtime pays = Overtime rate Number of overtime hours worked Monthly salary = Monthly overtime pays + Basic salary h) Figure 6 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 5. Figure 6: Expected output for Task 4 Task 5: Write a function named displayAnalysis. f) This is a non-returning function. g) It takes an array of Employee of type struct and the number of employees calculated in Task 2 as input parameters. h) The function should display departments' names, total monthly overtime pays, and total monthly salary. i) Figure 7 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 5. Figure 7: Expected output for Task 5 Task 6: Write a main function to perform the following tasks: Dr Eiliyah Wo d) Declare one-dimensionaf array variable with 50 elements for a structure type Employee. 6 of 7 e) The function may need to call the functions that are defined in the previous task to produce the output as shown in Figure 8. Note: Please use proper output formatting. f) Figure 8 shows the complete output that will be displayed on the screen based on Figure 7: Expected output for Task 5 Task 6: Write a main function to perform the following tasks: Dr Eiliyah Wong d) Declare one-dimensional array variable with 50 elements for a structure type Employee. e) The function may need to call the functions that are defined in the previous task to produce the output as shown in Figure 8. Note: Please use proper output formatting. f) Figure 8 shows the complete output that will be displayed on the screen based on the data in the input file "input. txt" shown in Figure 5. Figure 8: Complete output for the data in the input file "input. txt

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

What is the purpose of a statement of cash flows? Discuss.

Answered: 1 week ago

Question

What makes Zipcar an attractive employer for which to work?

Answered: 1 week ago

Question

Evaluate Figure 6-9; what other questions would you ask, and why?

Answered: 1 week ago