Anda di halaman 1dari 2

3p4

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
int main ()
{
double ga, fit ,st,sst,mt,pp,hi;
string name;
ofstream outfile;
outfile.open ("output.dat");
cout << " enter gross amount "<<endl;
cin >> ga ;
cin.ignore(100,'\n');
cout << "enter name of employer "<< endl;
getline(cin,name);
fit =15.0/100 * ga;
st = 3.5/100 * ga;
sst = 5.75/100 * ga;
mt = 2.75/100 * ga;
pp = 5.0/100 * ga;
hi = 75.0;
outfile << fixed << showpoint << setprecision(2);
outfile << name << endl
<< left
<< setw(26)<< setfill('.')<< "Gross Amount: " << " $"
<< right << setw (10)<< setfill (' ')<< ga << endl
<< left
<< setw(26)<< setfill('.')<< "Fedral Tax: " << " $"
<< right << setw (10)<<setfill (' ')<< fit << endl
<< left
<< setw(26)<< setfill('.')<< "State Tax: " << " $"
<< right << setw (10)<< setfill(' ')<< st << endl
<< left
<< setw(26)<< setfill('.')<< "Social Security Tax: " << " $"
<< right << setw (10) << setfill(' ')<< sst << endl
<< left
<< setw(26)<< setfill('.')<< "Medicare/ Medicaid Tax: " << " $"
<< right << setw (10) << setfill(' ')<< mt << endl
<< left
<< setw(26)<< setfill('.')<< "Pension Plan: " << " $"
<< right <<setfill(' ') << setw (10)<< pp << endl
<< left
<< setw(26)<< setfill('.')<< "Health Insurance: " << " $"
<< right << setw (10) << setfill(' ') << hi << endl
<< left
<< setw(26)<< setfill('.')<< "Net Pay: " << " $"
<< right << setw (10)<<setfill(' ')<< ga-(fit + st + sst+ mt+ pp + hi ) << endl;
return 0;
}