1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
//payroll program
//created by Jett Bailes
#include <iostream>
#include <string>
#include <iomanip>
using std::endl;
using std::cout;
using std::cin;
using std::string;
using std::fixed;
using std::setprecision;
double calcFWT(double, double, double);
double calcFICA(double, double, double);
double calcNetPay(double, double, double, double);
void getInput(string &, double &);
void displayInfo(string, double, double, double);
int main()
{
string name = "";
double weeklySalary = 0.0;
double FWTrate = .2;
double FWT = 0.0;
double FICArate = .08;
double FICA = 0.0;
double weeklyNetPay = 0.0;
cout << fixed << setprecision(2);
getInput(name, weeklySalary);
cout << endl;
FWT = calcFWT(weeklySalary, FWTrate, FWT);
FICA = calcFICA(weeklySalary, FICArate, FICA);
calcNetPay(weeklySalary, FICA, FWT, weeklyNetPay);
displayInfo(name, FWT, FICA, weeklyNetPay);
return 0;
}
//////////////////////////////////////////
double calcFWT(double weeklySalary, double FWTrate, double FWT)
{
FWT = weeklySalary * FWTrate;
return FWT;
}
double calcFICA(double weeklySalary, double FICArate, double FICA)
{
FICA = weeklySalary * FICArate;
return FICA;
}
double calcNetPay(double weeklySalary, double FICA, double FWT, double weeklyNetPay)
{
double sum = FICA + FWT;
weeklyNetPay = weeklySalary - sum;
return weeklyNetPay;
}
////////////////////////////////////
void getInput(string &employeeName, double &salary)
{
cout << "Enter name: ";
getline (cin, employeeName);
cout << "Enter weekly salary: ";
cin >> salary;
}
void displayInfo (string employeeName, double FWT, double FICA, double weeklyNetPay)
{
cout << "Name: " << employeeName << endl;
cout << "FWT: " << FWT << endl;
cout << "FICA: " << FICA << endl;
cout << "Weekly Net Pay: " << weeklyNetPay << endl;
}
|