473,410 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

How do I create a payroll system using arrays?

Create a payroll program to store and calculate the payroll for a small company with a maximum of 20 employees.

Program parameters are as follows:

1. 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
T or t to display total payroll
S or s to display the info of all employees
Z or z to exit program

The information for each employee is: employee number, hours worked, pay rate per hour, tax deduction.

2. Use an array of doubles to store employee information.

3. Menu 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

4. 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

5. Option T or t: calculate and output the sum of the total pay of all
. employees.

6. Option S or s: display the information for all employees in the same
. format as in option B.

7. Option Z or z: exit the program.

#include <stdio.h>
#define MAX [20]


int main(void)
{
int i;
for (i=0;i<=20;i++)
{
char MenuOption=0;
int EmployeeNumber;
double Hours;
double Pay;
double Tax;
double EmployeeTotalPay;
double TotalPayroll;
printf("Menu option Information Type\n");
printf("A= Add Employee Information\n");
printf("D= Display Employee Information\n");
printf("T= Display Total Payroll\n");
printf("S= Display Information For All Employees\n");
printf("Z= Exit Program\n\n");
printf("Please enter the letter of the Menu Option for the Operation you wish to perform.\nThen press enter:\n");
scanf(" %c",&MenuOption);

switch (MenuOption)
{
case 'Z': case 'z':
printf("You have chosen to Exit the program.\nGood-Bye.");
return 0;

case 'A': case 'a':
printf ("Enter the employees Employee Number:\n");
scanf("%lf", &EmployeeNumber);
printf("Please input the employee's number of hours worked: ");
scanf(" %lf",&Hours);
printf("Please input the employee's hourly pay rate: ");
scanf(" %lf",&Pay);
printf("Please input the employee's tax rate deduction as a decimal(i.e.: %% 5.50 = .0550: ");
scanf(" %lf",&Tax);
printf("Employee Number: %ld\nHours worked: %.2f\nPay rate: $ %.2f\nTax Rate Deduction: %.4f %\nTotal Pay: $ %.2f\n\n\n",EmployeeNumber,Hours,Pay,Tax,Hours*Pay-Hours*Pay*Tax);
printf("Please input the employee's Total Pay as a decimal,\n(i.e.: $430.25 = 430.25) for storage in the payroll database: ");
scanf(" %.2lf",&EmployeeTotalPay);
printf(" %.2lf",TotalPayroll);
return;
break;
}
return 0;
}
}
Feb 21 '15 #1
2 6061
weaknessforcats
9,208 Expert Mod 8TB
Do you know how to use a struct?
Feb 21 '15 #2
dgrex
1
Where did you use arrays and the do-while loop as instructed?
Feb 25 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yaya via DotNetMonster.com | last post by:
Let's say I wana create a set of arrays A1,A2,A3.... so if I use a for loop, can I create the arrays ? for(int i=0; i<3; i++) { int A(i+1) = new int; } ^ | A1,A2,A3
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
0
by: antique | last post by:
iam supposed to CREATE A FUNCTION INT ADJUSTEDSUM (INT,INT) 1. find the sum of the array of size 100 2. find the number of occurrence of a MIN and MAX number if its twice or more only use 1...
0
by: knightwolf | last post by:
Hi Guys, I need some help.. Im trying to develop a window base payroll system using visual basic 2005 and mysql 4.0. You see Im new with this languages and I had few materials to start with as...
7
sammyboy78
by: sammyboy78 | last post by:
I was wondering about the format of calling methods using arrays. I know that to call a method when not using arrays it would be formatted in the first class like: public void methodName(...
0
by: aldarun23 | last post by:
Assume that you are a Systems Analyst working for a big company to develop their payroll System. What Software Development methodology will you use and Why?
3
by: bryankerr | last post by:
what software methodology would be suitable for a payroll system?
4
by: jnce | last post by:
hi everyone! im a student and im trying to make a basic employee payroll system using ms access 2007. can anyone give me an idea on how to create a employee payroll system using ms access...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.