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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#include <iostream>
#include <cstring>
#include <iomanip>
//no constants in this lab
using namespace std;
double contribution;
//PROTOTYPES
void obtain_worker_values (char [80], char [80], char [80], double &);
void calc_contribution( double &, double &, double &, double);
void disp_report_to_worker(char [80], char [80],
char [80], double , double );
int main(void)
{
char worker_name [80], contribution_yr [80], acc_num [80];
double netpay, contribution, contribution1, netPay;
//CALLS
//Obtain Worker's Information
obtain_worker_values (worker_name, contribution_yr, acc_num, netpay);
//Calculate Contribution
calc_contribution (netpay, contribution, netPay, contribution1);
//disp_report_to_worker
disp_report_to_worker(worker_name, contribution_yr, acc_num, netPay,
contribution1);
return 0;
}
//FUNCTIONS
//set student values
void obtain_worker_values( char worker_name [80], char contribution_yr [80],
char acc_num [80], double &netpay)
{
cout << "Enter worker's name: ";
cin.getline(worker_name,80);
cout << "Enter the contribution year: ";
cin.getline(contribution_yr,80);
cout << "What is your account number?: ";
cin.getline (acc_num,80);
cout << "Enter your Net Pay: ";
cin >> netpay;
cout << endl;
}
//calc assignment average
void calc_contribution( double &netpay, double &contribution, double &netPay,
double taxrate)
{
contribution = 0;
if (netpay <= 2000)
{
taxrate = 0.07;
}
else if (netpay > 2000 || netpay <= 17000)
{
taxrate = 0.10;
}
else if (netpay > 17000 || netpay <= 30000)
{
taxrate = 0.15;
}
else if (netpay > 30000 || netpay <= 50000)
{
taxrate = 0.28;
}
else if (netpay > 50000)
{
taxrate = 0.33;
}
netPay = netpay;
contribution = netPay * taxrate;
cout << endl << endl;
}
//disp student scores to student
void disp_report_to_worker(char worker_name [80], char contribution_yr [80],
char acc_num [80], double netPay, double contribution)
{
cout << "********************* Start Report ************************"
<< endl;
cout << "* *"
<<endl;
cout << "* Net Pay Report *"
<< endl;
cout << "* Worker's Name: " <<worker_name << " *"
<< endl;
cout << "* Contribution Year: " << contribution_yr << " *"
<< endl;
//cout << "* Worked Hours: " << workHours << " "
// << " *" << endl;
cout << "* Account Number: " << acc_num
<< " *" << endl;
cout << "* Net Pay: " << netPay
<< " *" << endl;
cout << "* Contribution: " << contribution
<<" *" <<endl;
cout << "******************* End Report ***************************";
cout << "\n\nDone\n\n";
|