//Kyu Bae //PayRollData-main.cpp //5-12-00 //C++ Project //Purpose: //This project deals with the establishment and manipulaation of an array //of representing payroll data for an organization. Each object is to contain the following // data about one employee in this organization: //1) Employee ID #. //2) Pointer to employee name //3) Hourly pay rate . //4) Number of exemptions. //5) Tax rate. //6) YTD hour worked. //7) YTD gross pay. //8) YTD net pay. //This program will provide and test at least 10 different employees. //YOu are to create a modular, menu driven program which will do at least the following: //1) Fill the employee objects. //2) Set all YTD balances to zero. //3) Input hours worked for various employees for s given pay period. Calculate teh gross // and net pay for that pay period and update all YTd fields. //4) print paycheck stub for each employee who worked during the period. //5) Input and change pay rate, exemptions and or name for various employee. //6) Print a report showing vacation day for the every 100 YTD hours. //7) Print a report showing YTD figures for each empoyee. #include #include #include #include #include #include #include "PayRollData.h" //prototypes int GetFile (PayRoll* EmployeeData); void MenuFunction (PayRoll* EmployeeData); int DoNumFunc(PayRoll* EmployeeData); void DoRezeroFunc(PayRoll* EmployeeData, int HowMany); void ChangeNumFunc(PayRoll* EmployeeData, int HowMany); void DoInputHourFunc(PayRoll* EmployeeData, int HowMany); void EditNameFunc(PayRoll* EmployeeData, int HowMany); void EditPayRateFunc(PayRoll* EmployeeData, int HowMany); void PrintAllFunc(PayRoll* EmployeeData, int HowMany); void PrintVacationFunc(PayRoll* EmployeeData, int HowMany); //global constant const int TotalEmployeeNum=10; //input: nothing going //declares class object and call menu functions //output: returning the integer. int main (void) { char Answer; PayRoll EmployeeData [TotalEmployeeNum]; cout <<" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"<"<> Choice; cin.ignore(); switch (Choice) { //calling function to ask how many employee number case 1: cout <<" You selected choice 1. "<> HowMany; return HowMany; } //input;employeedata object and howmany static variable. //seting the all YTD values to zero. //output:returns nothing void DoRezeroFunc(PayRoll* EmployeeData, int HowMany) { int i; for(i=0; iSetYTDGrossPay(0); EmployeeData->SetYTDHrWorked(0); EmployeeData->SetYTDNetPay(0); } } //input;employeedata object and howmany static variable. //entering the hours worked by the employees //output: returns nothing void DoInputHourFunc(PayRoll* EmployeeData, int HowMany) { int i; int WorkerNum; double HourWorked, TempTotalHour; double OverTime; double GrossPay, TempGrossPay, Deduction; double NetPay,TempNetPay; cout < "<>WorkerNum; for(i=0; iGetEmployeeIdNum();EmployeeData++,i++) ;//null if (i> HourWorked; //adding weekly hours worked to YTD HOURs Worked TempTotalHour=EmployeeData->GetYTDHrWorked()+HourWorked; EmployeeData->SetYTDHrWorked(TempTotalHour); if(HourWorked>40) { OverTime=HourWorked-40; GrossPay=(40*EmployeeData->GetPayRate())+(1.5*EmployeeData->GetPayRate()*OverTime); } else { GrossPay=(HourWorked*EmployeeData->GetPayRate()); } Deduction=(EmployeeData->GetTaxRate()*GrossPay)-(EmployeeData->GetExemptionNum()*15); NetPay=GrossPay-Deduction; //adding gross pay to YTD gross pay TempGrossPay=EmployeeData->GetYTDGrossPay()+GrossPay; EmployeeData->SetYTDGrossPay(TempGrossPay); //adding netpay to YTD net pay TempNetPay=EmployeeData->GetYTDNetPay()+NetPay; EmployeeData->SetYTDNetPay(TempNetPay); //printing paycheck stub for each employee number cout <<"******************************************"<GetEmployeeIdNum()<GetEmployeeName()<GetPayRate()<GetExemptionNum()<GetTaxRate()<GetYTDHrWorked()<GetYTDGrossPay()<GetYTDNetPay()<GetYTDHrWorked()/100); cout<GetEmployeeIdNum() <GetEmployeeName() <GetYTDHrWorked()<GetEmployeeIdNum() <GetEmployeeName() <GetYTDHrWorked() <GetYTDGrossPay() <GetYTDNetPay()<"<>WorkerNum; cin.ignore(); for(i=0; iGetEmployeeIdNum();EmployeeData++,i++) ;//null if(i "<>NewPayRate; cin.ignore(); EmployeeData->SetPayRate(NewPayRate); cout <"<>WorkerNum; cin.ignore(); for(i=0; iGetEmployeeIdNum();EmployeeData++,i++) ;//null if(i"<>NewExemptionNum; cin.ignore(); EmployeeData->SetExemptionNum(NewExemptionNum); } //input:passing the object and # of employee //editing function for the name //setting the new name //output:returning nothing void EditNameFunc(PayRoll* EmployeeData, int HowMany) { int i; int WorkerNum; char NewName[80]; cout <<" Which employee's Name do you want to edit?"< "<>WorkerNum; cin.ignore(); for(i=0; iGetEmployeeIdNum();EmployeeData++,i++) ;//null if(i"<SetEmployeeName(NewName); } //input : passing the employeedata object //geting out the file to initialize the objects. //output: returnsthe integers. int GetFile (PayRoll* EmployeeData) { char FileName[81]; int i; ifstream InputFile; cout <> TempIdNum; EmployeeData->SetEmployeeIdNum(TempIdNum); cout <GetEmployeeIdNum()<> TempName; EmployeeData->SetEmployeeName(TempName); cout << EmployeeData->GetEmployeeName()<> TempHrPayRate; EmployeeData->SetPayRate(TempHrPayRate); cout <GetPayRate()<> TempExemption; EmployeeData->SetExemptionNum(TempExemption); cout <GetExemptionNum()<> TempTaxRate; EmployeeData->SetTaxRate(TempTaxRate); cout <GetTaxRate()<> TempYTDHrWorked; EmployeeData->SetYTDHrWorked(TempYTDHrWorked); cout <GetYTDHrWorked()<> TempYTDGrossPay; EmployeeData->SetYTDGrossPay(TempYTDGrossPay); cout <GetYTDGrossPay()<> TempYTDNetPay; EmployeeData->SetYTDNetPay(TempYTDNetPay); cout <GetYTDNetPay()<