I am trying to create a Payroll Calculation program that will calculate an employees hourly pay on a weekly
basis; including overtime, payroll deductions (federal, state, local taxes, medical insurance deductions), etc...
I am pretty new to programming and need some help with this. I have included the code that I have done but am not sure if I am coding this correctly.
I am trying to create it so that the main will only control execution statements and supporting function calls. Could someone please help me with this program?
Is there a better way to achieve my goal? I am not sure but it seems as though my code is out of place. Should I continue on with the way I am coding or should I use object oriented programming to create my program? if I should then how so? I am so confusedCode:#include<iostream> #include<string> using namespace std; double OvertimeHours [2]; double HourlyPayRate ; double OvertimePay; double GrossPay; const double StateTax = .30; //30% State Tax Rate int main() { int EmployeeID; void HourlyPayRate(double hours; double rate) void int MaritalStatus; /**************************************************************************************************/ //Determines the Marital Status of Employees switch(MaritalStatus) { case 'M': case 'm': cout<< "Married"; break; case 'S': case 's': cout<< "Single"; break; default: cout << "Unknown Selection!\n" << "Choose Again.\n"; } /**************************************************************************************************/ if (MaritalStatus == 'M' || 'm') { FedTax = .15 * GrossPay; //15% federal income tax for married employees GrossPay = GrossPay - 18.00; //$18.00 medical insurance deduction else if (MaritalStatus == 'S' || 's') FedTax = .20 * GrossPay; //20% federal income tax for single employees GrossPay = GrossPay - 10.00; //$10.00 medical insurance deduction /**************************************************************************************************/ //This function will calculate the hourly wage void HourlyPayRate() { double hours = 0; double rate = 0 cout << endl << Number of Hours Worked: "; cin >> hours; cout << endl << "Pay Per Hour is: "; cin >> rate; cout << endl; if (hours <= 40) { hours = (rate * hours); cout << endl << setiosflags(ios::fixed) << setprecision (2) << "The hourly worker's weekly gross is: $" << hours << endl; return; } if (hours > 40) { hours = (rate * 40) + ((rate * 1.5) * (hours - 40)); cout << endl << setiosflags(ios::fixed) << setprecision (2) << "The hourly worker's weekly gross is: $" << hours << endl; return; } else { cout << endl << "Data Entry Not Valid, Please Reenter Data." << endl; return; } return; }![]()



LinkBack URL
About LinkBacks



