rendered paste body/****************************************//* Author: Stephen B. Steinberg *//* Filename: Ultrapayroll.cpp *//* This program calculates an employees *//* weekly gross and net earnings before *//* and after taxes. Hopefully. *//****************************************/#include <string>#include <iostream>using namespace std;double taxes (double netpay); // funky function prototypeint main(){ const double maxhours = 40.0; // Max hours before overtime pay double grosspay; //cash earned before taxes double netpay; //..and the pittance left afterwards double payrate; //hourly payrate double weeklyhours; //hours per week double aftertaxes; //makes the function functional! string EmpID;//Employee ID number grosspay = netpay = 0; weeklyhours = payrate = aftertaxes = 0; //initializing values cout<<"This program will calculate weekly wages and deductions." <<endl; cout<<"Please enter the employee's ID #: "; cin>>EmpID; cout<< "Now enter the employee's hourly pay rate: "; cin>>payrate ; if (payrate <= 0) { cout << "Yeah, that's not gonna work. Start Over."; return (0) ; } // erroneous input fixer upper! cout << "Great. Now, enter the number of hours worked: "; cin >> weeklyhours ; if (weeklyhours <= 0) { cout << "Bad input. Start Over" ; return (0); } // in your face, user! no bad input here! if (weeklyhours > maxhours) grosspay = (((weeklyhours - maxhours) * (payrate * 1.5)) + (payrate * maxhours)) ; else grosspay = (weeklyhours * payrate); netpay = taxes(grosspay); /* Above block calculates whether or not there is overtime and adjusts pay accordingly*/ cout << "Weekly net income for employee # " << EmpID << " is: $" <<netpay <<endl; return(0);}/*****************************************************************************/double taxes (double grosspay){ char isMarried; int dependants; double fedtax, statetax, socialsec, calcdtaxes, tempNetpay; cout << "Is the employee married? Answer Y or N: " ; cin >> isMarried ; //inputs marital status if ((isMarried != 'y' || isMarried != 'Y') || (isMarried != 'n' || isMarried != 'N')) { cout << "You can only put 'Y' or 'N' here. Please Start Over."; return (0) ; } // protects against erroneous input cout << "Enter number of dependants. For ANY number above 2, please only enter '3' :" ; cin >> dependants ; //inputs number of dependants if ((dependants < 0) || (dependants > 3)) { cout << "Can't have a negative number of dependants. Start Over!!"; return (0); } //case statements to determine number of dependants if (isMarried == 'y' || isMarried == 'Y') switch (dependants) { case 0 : fedtax = (grosspay * 0.15); break; case 1 : fedtax = (grosspay * 0.12); break; case 2 : fedtax = (grosspay * 0.10); break; case 3 : fedtax = (grosspay * 0.08); break; }; if (isMarried == 'n' || isMarried == 'N') switch (dependants) { case 0 : fedtax = (grosspay * 0.25); break; case 1 : fedtax = (grosspay * 0.24); break; case 2 : fedtax = (grosspay * 0.22); break; case 3 : fedtax = (grosspay * 0.20); break; }; statetax = (fedtax * 0.25); socialsec = grosspay * 0.075; calcdtaxes = (socialsec + fedtax + statetax); tempNetpay = (grosspay - calcdtaxes); cout<< "Federal Withholding is $" <<fedtax << endl; cout<< "State withholding is $" <<statetax << endl; cout<< "The amount of Social Security taken out was $" <<socialsec <<endl; return(tempNetpay);}