Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
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
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.
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
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
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
the code comes back with this error
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
the code comes back with this error
Solution
by Bartleby Expert
Knowledge Booster
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
- Create a c programming flowgorithm chart for the following: You must use at least two different arrays A character array to store the welcome message (note: when creating your flowchart you will need to declare this message with the string data type as a variable and assign the message). Use the puts() function to display the message to the screen. An array with a float datatype to store the prices of the items Prompt the user to enter how many items they have to total. Use a for() statement to fill the array using the value the user entered as the end point of the loop. Use an accumulating total statement to compute the total sales There is a constraint - if the price of any one item is greater than $10.00 it is considered invalid, you must use a repetitive statement to display a message and force the user to enter a value less than $10.00 You need to create a function to compute the final total using a sales tax of 6% (.06)arrow_forwardInstruction: It should be a C++ PROGRAM INCLUDE THE HEADER FILE, MAIN CPP, AND BSTREE.CPP There is a real program developed by a computer company that reads a report ( running text ) and issues warnings on style and partially corrects bad style. You are to write a simplified version of this program with the following features: Statistics A statistical summary with the following information: Total number of words in the report Number of unique words Number of unique words of more than three letters Average word length Average sentence length An index (alphabetical listing) of all the unique words (see next page for a specific format) Style Warnings Issue a warning in the following cases: Word used too often: list each unique word of more than three letters if its usage is more than 5% of the total number of words of more than three letters Sentence length : write a warning message if the average sentence length is greater than 10 Word length : write a warning message if the…arrow_forwardC++ program Write a program that will predict the size of a population of organisms. The program should ask the user for the starting number of organisms, their average daily population increase (as a percentage of current population), and the number of days they will multiply. A loop should display the size of the population for each day.arrow_forward
- Instructions C++ 8-17 A company hired 10 temporary workers who are paid hourly and you are given a data file that contains the last name of the employees, the number of hours each employee worked in a week, and the hourly pay rate of each employee. You are asked to write a program that computes each employee’s weekly pay and the average salary of all employees. The program then outputs the weekly pay of each employee, the average weekly pay, and the names of all the employees whose pay is greater than or equal to the average pay. If the number of hours worked in a week is more than 40, then the pay rate for the hours over 40 is 1.5 times the regular hourly rate. Use two parallel arrays: a one-dimensional array to store the names of all the employees (Name) a two-dimensional array of 10 rows and 3 columns to store the number of hours an employee worked in a week (Hrs Worked), the hourly pay rate (Pay Rate), and the weekly pay (Salary). Your program must contain at least the following…arrow_forwardC++ - No library functions like atoi Create a machine code program to input two one-digit numbers, add them, and output the one-digit sum. Submit your "machine code" followed by a 'zz.' User Input one: 3 Input two: 4 Output the one-digit sum: 7 zzarrow_forwardNeed python help running code and others. Functions are ideal for use in menu-driven programs. When the user selects an item from a menu, the program can call the appropriate function. Write a menu-driven program for Burgers. Display the food menu to a user (Just show the 5 options' names and prices - No need to show the details!) Use numbers for the options and the number "6" to exit. If the user enters "6", your code should not ask any other questions, just show a message like "Thank you, hope to see you again!" Ask the user what he/she wants and how many of them. (Check the user inputs) Keep asking the user until he/she chooses the exit option. Use a data structure to save the quantities of the orders. You should use ArrayLists/Array Bags, or LinkedLists/LinkedBags (one or more of them) to save data. Calculate the price. Ask the user whether he/she is a student or a staff. There is no tax for students and a 9% tax for staff. Add the tax price to the total price.…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education