Question: Must Be Written in C Must Be Written in C Create a payroll program to store and calculate the payroll for a small company with
Must Be Written in C
Must Be Written in C
Create a payroll program to store and calculate the payroll for a small company with a maximum of 15 employees.
Ask the user to enter the number of employees and if no more than 15 are entered, re-prompt the user as many times as needed until a valid input is entered.
Create an array to fit the valid number of employees entered and to store the following information for each employee:employee number, hours worked, pay rate per hour, tax deduction.
Use an array of doubles to store employee information.
Program parameters are as follows:
Create a menu with the following options (use a do-while loop):
A or a to add employee info
D or d to display employee info
P or p to display total payroll
S or s to display the info of all employees
Z or z to exit program
Option A or a: ask the user for the employee information one value at a time and store it in the array.
Please enter employee number: 2190
Please enter hours worked: 32.50
Please enter pay rate: 9.25
Please enter tax rate deduction: 5.50
Option D or d: ask the user for an employee number as integer and display the information for the corresponding employee (cast the employee number in the array to integer and then compare). If employee number does not match, output a msg. indicating no such employee. If the employee number is a match, output all the employee information stored in addition to the calculated deduction and salary.
Output sample:
Info for employee number: 2190
Hours worked: 32.50
Pay rate: $ 9.25
Tax deduction: 5.50 %
Total pay: $ 284.89
Option P or p: calculate and output the sum of the total pay of all employees.
Option S or s: display the information for all employees in the same format as in option B.
Option Z or z: exit the program.
Super Challenge/ no extra points, just for fun:
Add a delete employee record option R or r that will delete the employee record and move the last employee record in the array to the empty slot of the deleted record.
Add a C or c option that outputs the count of employee records in the array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
