CASE STUDY – PAYROLL SYSTEM PHASE 5: ARRAY The purpose of this phase is to expan
ID: 3714594 • Letter: C
Question
CASE STUDY – PAYROLL SYSTEM PHASE 5: ARRAY
The purpose of this phase is to expand the payroll system to display all employee information in a tabular form by including arrays.
A) Display company title and a header that labels the output in a tabular form. Input the first name and last name of an employee.
char firstname[100][10], lastname[100][15];
or you may use
#include
using namespace std;
string firstname[100], lastname[100];
int hw[100],empid[100];
Hint: You may want to use the following I/O manipulators.
#include , setw(15), setprecision(2) setiosflags(ios::fixed|ios::showpoint|ios::left)
DR. EBRAHIMI'S PAYROLL INSTITUTE
SSN
HW
HR
OTH
OTP
REGP
GROSS
TAX
NET
===
113
50
20
10
300
800
1100
385
715
223
45
15
5
112.5
675
787.5
275
512.5
B) Take advantage of arrays by breaking programs into separate units. Each unit should have a separate loop. (Do not use functions.)
Read all data into arrays
Compute all the overtimepays
Compute all the grosspays
Compute all the taxratesCompute all the netpays
Display all the arrays
C) Include separate functions to read in the data, compute the gross pay, tax rate, net pay, and overtime pay for all employees, and display.
Need to expand my payroll program, here is what I have so far-
#include <iostream>
using namespace std;
int main(){
int numberofemployees;
int employeeid, hoursworked;
float hourlyrate, grosspay,taxrate,tax,netpay,overtimepay, overtimerate, overtime;
while ( 1 ){
if( grosspay <1000)
taxrate = 0.30;
else
taxrate = 0.10;{
if( hoursworked > 40)
hourlyrate = hourlyrate * 1.5;{
cout <<"ENTER THE EMPLOYEE ID:";
cin >>employeeid;
cout <<"ENTER THE HOURS WORKED:";
cin >>hoursworked;
cout <<"ENTER THE HOURLY RATE:";
cin >>hourlyrate;
grosspay=hoursworked*hourlyrate;
tax=taxrate*grosspay;
netpay=grosspay-tax;
overtimerate=hourlyrate*1.5;
overtime=hoursworked - 40;
overtimepay=overtime*overtimerate;
cout <<"EMPLOYEE ID IS "<<employeeid;
cout <<"YOUR HOURS WORKED ARE "<<hoursworked;
cout <<"YOUR HOURLY RATE IS "<<hourlyrate;
cout <<"YOUR GROSSPAY IS "<<grosspay;
cout <<"YOUR TAXRATE IS "<<taxrate;
cout <<"YOUR NET PAY IS "<<netpay;
cout <<"YOUR OVERTIME PAY IS "<<overtime;
numberofemployees = numberofemployees + 1;
}}}}
FIRST NAME LAST NAME STATSSN
HW
HR
OTH
OTP
REGP
GROSS
TAX
NET
======== ======== ==== =======
=== ==== ===== ===== ===== ===== ===== John Smith M113
50
20
10
300
800
1100
385
715
Jane Dow M223
45
15
5
112.5
675
787.5
275
512.5