Written in C)   Create a payroll program to store and calculate the payroll for a small company as follows: Create an array of floats that is 4 rows and 50 columns, with the columns being the number of employee records stored in the array. Program parameters are as follows: Create a menu in a function menu and call it with the following options (use a do-while loop): A or a to add employee info D or d to display employee info T or t to display total payroll S or s to display the info of all employees C or c to display the count of employees present in the array F or F to delete a record Z or z to exit program The information for each employee is: employee number, hours worked, pay rate per hour, tax deduction. Option A or a: Call the function possible to check and if the index returned is 50 then output a msg saying that the array is full. If the index returned is less than 50 the call the function add, pass to it the available index as the third argument and the function will ask the user for one employee information at a time and store it in that column index. 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. Call the function search and if the function returns 1000, output a msg. indicating “no such employee”. If the function returns a number                 other than 1000, then call function record and pass the index returned from search to it that will 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 Total earned: $ 300.63 Tax deduction: 5.50 % for an amount of $ 16.53 Paycheck: $ 284.09 Option T or t: calculate and return the sum of the total for the paychecks of all employees. Call function paycheck and output the return of the function in a formatted statement. Option F or f: to delete an employee record. Get the employee number from the user and call function search to find out if the employee is in the array and what column index is the employee in. Then call function Delete on that index if the employee is in the array and if not, output a msg. saying no such employee. Option S or s: display the information for all employees in the same format as in option D one employee at a time separated by a line of ------, by calling the function record on each column index that has an employee. Option C or c: Output the number of employees in the array. Use the function count. Option Z or z: exit the program. use all these functions in the program. Functions: cat[][50] is an array parameter n is an integer parameter for the number of rows int possible(float cat[][50], int n); // function checks if an array element is empty for an employee record to be added. Returns the first free index in the array available to add employee (dynamic scan). If index returned is 50 then the array is full. void add(float cat[][50], int n, int m); // function used for adding employee. int search(float cat[][50], int n, int mouse); // function returns the index where employee number stored in mouse is located. Returns 50 if there is no such employee. int count(float cat[][50], int n); // function returns the number of employee records present in the array

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false: a. To use a predefined function in a program, you...
icon
Related questions
Question
(Written in C)
 
Create a payroll program to store and calculate the payroll for a small company as follows:
Create an array of floats that is 4 rows and 50 columns, with the columns being the number of employee
records stored in the array.
Program parameters are as follows:
Create a menu in a function menu and call it with the following options (use a do-while loop):
A or a to add employee info
D or d to display employee info
T or t to display total payroll
S or s to display the info of all employees
C or c to display the count of employees present in the array
F or F to delete a record
Z or z to exit program
The information for each employee is: employee number, hours worked, pay rate per hour, tax
deduction.
Option A or a:
Call the function possible to check and if the index returned is 50 then output a msg saying that the
array is full. If the index returned is less than 50 the call the function add, pass to it the available index as
the third argument and the function will ask the user for one employee information at a time and store
it in that column index.
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. Call the function search and if the
function returns 1000, output a msg. indicating “no such employee”. If the function returns a number
 
 
 
 
 
 
 
 
other than 1000, then call function record and pass the index returned from search to it that will 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
Total earned: $ 300.63
Tax deduction: 5.50 % for an amount of $ 16.53
Paycheck: $ 284.09
Option T or t: calculate and return the sum of the total for the paychecks of all employees. Call function
paycheck and output the return of the function in a formatted statement.
Option F or f: to delete an employee record. Get the employee number from the user and call function
search to find out if the employee is in the array and what column index is the employee in. Then call
function Delete on that index if the employee is in the array and if not, output a msg. saying no such
employee.
Option S or s: display the information for all employees in the same format as in option D one employee
at a time separated by a line of ------, by calling the function record on each column index that has an
employee.
Option C or c: Output the number of employees in the array. Use the function count.
Option Z or z: exit the program.
use all these functions in the program.
Functions: cat[][50] is an array parameter n is an integer parameter for the number of rows
int possible(float cat[][50], int n); // function checks if an array element is empty for an employee
record to be added. Returns the first free index in the array available to add employee (dynamic scan). If
index returned is 50 then the array is full.
void add(float cat[][50], int n, int m); // function used for adding employee.
int search(float cat[][50], int n, int mouse); // function returns the index where employee number
stored in mouse is located. Returns 50 if there is no such employee.
int count(float cat[][50], int n); // function returns the number of employee records present in the
array
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

the code comes back with this error

error: expected declaration or statement at end of input
Transcribed Image Text:error: expected declaration or statement at end of input
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr