Guest User

Untitled

a guest
Jan 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. void main()
  9. {
  10.     fstream output;
  11.     string name;
  12.     float grossPay,fedTax,stateTax,socSec,medi,penPlan,insurance,netPay;
  13.    
  14.     output.open("output.txt");
  15.  
  16.     cout << "Please enter your name: ";
  17.     getline(cin,name);
  18.     cout << "Please enter your Gross Amount: ";
  19.     cin >> grossPay;
  20.    
  21.     fedTax = (grossPay*.15);
  22.     stateTax = (grossPay*.035);
  23.     socSec = (grossPay*.0575);
  24.     medi = (grossPay*.0275);
  25.     penPlan = (grossPay*.05);
  26.     insurance = 75;
  27.  
  28.     netPay = (grossPay-(fedTax+stateTax+socSec+medi+penPlan+insurance));
  29.  
  30.     cout << left << "\n" << name;
  31.     cout << left << "\n" << "Gross Amount:" << setw(15) << setfill('.') << right << "$ " << setprecision(2) << fixed << grossPay;
  32.     cout << left << "\n" << "Federal Tax:" << setw(16) << setfill('.') << right << "$ " << setprecision(2) << fixed << fedTax;
  33.     cout << left << "\n" << "State Tax:" << setw(18) << setfill('.') << right << "$ " << setprecision(2) << fixed << stateTax;
  34.     cout << left << "\n" << "Social Security Tax:" << setw(8) << setfill('.') << right << "$ " << setprecision(2)  << fixed << socSec;
  35.     cout << left << "\n" << "Medicare/Medicaid Tax:" << setw(6) << setfill('.') << right << "$ " << setprecision(2) << fixed << medi;
  36.     cout << left << "\n" << "Pension Plan:" << setw(15) << setfill('.') << right << "$ " <<  setprecision(2) << fixed << penPlan;
  37.     cout << left << "\n" << "Health Insurance:" << setw(11) << setfill('.') << right << "$ " << setprecision(2) << fixed << insurance;
  38.     cout << "\n" << "----------------------------------------------";
  39.     cout << left << "\n" << "Net Pay:" << setw(20) << setfill('.') << right << "$ " << setprecision(2) << fixed << netPay;
  40.  
  41.     cin.ignore();
  42.     cin.get();
  43. }
Add Comment
Please, Sign In to add comment