Question: 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.

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.

*Why do I keep getting 2 "nan" values on my first output??*

"payroll.in"

1225 S Saverio Smith 45 20 7995 H Michelle Smith 50 25 8716 m Santino Smith 35 30 1512 s Nicholas Smith 30 12 1513 M Julianna Smith 42 24

//CODE

#include #include #include #include

using namespace std; int readalldata(long int[],char[],string[],string[],int[],double[],const int); //FUCNTION PROTOTYPES void computeotp(int[],int[],double[],double[],int); void computegp(double[],int[],double[],double[],double[],int); void computetaxrate(double[],double[],int); void computemtaxrate(char[],double[],double[],int); void computenetpay(double[],double[],double[],double[],double[],int); void displayarrays(long int[],char[],string[],string[],int[],double[],int[],double[],double[],double[],double[],double[],int);

int main(){ const int MAXSIZE = 100; //FOR MAX OF 100 EMPLOYEES int n; long int employeeid[MAXSIZE]; char marital[MAXSIZE]; string firstname[MAXSIZE], lastname[MAXSIZE]; double hourlyrate[MAXSIZE], grosspay[MAXSIZE], netpay[MAXSIZE], taxrate[MAXSIZE], mtaxrate[MAXSIZE], taxamount[MAXSIZE], regpay[MAXSIZE], otpay[MAXSIZE]; int hoursworked[MAXSIZE], othours[MAXSIZE]; //DECLARATION OF ALL VARIABLES

//FUCNTION CALLS n = readalldata(employeeid,marital,firstname,lastname,hoursworked,hourlyrate,MAXSIZE); //GETS ALL THE DATA computeotp(hoursworked,othours,hourlyrate,otpay,n); computegp(grosspay,hoursworked,hourlyrate,otpay,regpay,n); computetaxrate(grosspay,taxrate,n); computemtaxrate(marital,mtaxrate,taxrate,n); computenetpay(taxamount,grosspay,taxrate,mtaxrate,netpay,n); displayarrays(employeeid,marital,firstname,lastname,hoursworked,hourlyrate,othours,otpay,regpay,grosspay,taxamount,netpay,n); return 0; }//MAIN

//FUCNTION DEFINITIONS int readalldata(long int employeeid[],char marital[],string firstname[],string lastname[],int hoursworked[],double hourlyrate[],int n){ ifstream fin("payroll.in"); n = 0; while(fin>>employeeid[n]>>marital[n]>>firstname[n]>>lastname[n]>>hoursworked[n]>>hourlyrate[n]) { n++; } fin.close(); return n; }//READALLDATA

void computeotp(int hoursworked[],int othours[],double hourlyrate[],double otpay[],int n){ for(int i = 0;i 40) othours[i] = hoursworked[i] - 40; //COMPUTE ALL OVERTIME HOURS/PAY otpay[i] = othours[i] * (hourlyrate[i] * 1.5); if (hoursworked[i]

void computetaxrate(double grosspay[],double taxrate[],int n){ //COMPUTE ALL THE TAXRATES for(int i = 0;i 1000) taxrate[i] = 0.30; else if((grosspay[i] > 800) && (grosspay[i] 500) && (grosspay[i] = 0) && (grosspay[i]

void computemtaxrate(char marital[],double mtaxrate[],double taxrate[],int n){ //COMPUTE MARITAL TAXRATES for(int i = 0;i

void computenetpay(double taxamount[],double grosspay[],double taxrate[],double mtaxrate[],double netpay[],int n){ //COMPUTE ALL THE NETPAYS for(int i = 0;i

void displayarrays(long int employeeid[],char marital[],string firstname[],string lastname[],int hoursworked[],double hourlyrate[],int othours[],double otpay[],double regpay[], double grosspay[],double taxamount[],double netpay[],int n){ //DISPLAY ALL THE ARRAYS cout

C) Include separate functions to read in the data, compute the gross

CAUserslsalzone1225 Desktop ESC Docs\C++ and OOPAC ++AM3CFixed.exe DR. EBRAHIMIE'S PAYROLL INSTITUTE EMP ID MARTIAL STAT FIRST NAME LAST NAME HW HR OTP REGP GROSS TAX NET S Saverio Smith 45 25 187.5 1125 1312.5 nan nan 7995 Michelle Smith 50 20 300 1000 1300 325 975 Santino Smith 35 30 0 1050 1050 315 735 8716 1512 Nicholas Smith 30 12 0 360 360 18 342 M Julianna 1513 Smith 42 24 72 1008 1080 324 756 Process exited after 0.01146 seconds with return value 0 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!