Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <iomanip>
- using namespace std;
- void main()
- {
- fstream output;
- string name;
- float grossPay,fedTax,stateTax,socSec,medi,penPlan,insurance,netPay;
- output.open("output.txt");
- cout << "Please enter your name: ";
- getline(cin,name);
- cout << "Please enter your Gross Amount: ";
- cin >> grossPay;
- fedTax = (grossPay*.15);
- stateTax = (grossPay*.035);
- socSec = (grossPay*.0575);
- medi = (grossPay*.0275);
- penPlan = (grossPay*.05);
- insurance = 75;
- netPay = (grossPay-(fedTax+stateTax+socSec+medi+penPlan+insurance));
- cout << left << "\n" << name;
- cout << left << "\n" << "Gross Amount:" << setw(15) << setfill('.') << right << "$ " << setprecision(2) << fixed << grossPay;
- cout << left << "\n" << "Federal Tax:" << setw(16) << setfill('.') << right << "$ " << setprecision(2) << fixed << fedTax;
- cout << left << "\n" << "State Tax:" << setw(18) << setfill('.') << right << "$ " << setprecision(2) << fixed << stateTax;
- cout << left << "\n" << "Social Security Tax:" << setw(8) << setfill('.') << right << "$ " << setprecision(2) << fixed << socSec;
- cout << left << "\n" << "Medicare/Medicaid Tax:" << setw(6) << setfill('.') << right << "$ " << setprecision(2) << fixed << medi;
- cout << left << "\n" << "Pension Plan:" << setw(15) << setfill('.') << right << "$ " << setprecision(2) << fixed << penPlan;
- cout << left << "\n" << "Health Insurance:" << setw(11) << setfill('.') << right << "$ " << setprecision(2) << fixed << insurance;
- cout << "\n" << "----------------------------------------------";
- cout << left << "\n" << "Net Pay:" << setw(20) << setfill('.') << right << "$ " << setprecision(2) << fixed << netPay;
- cin.ignore();
- cin.get();
- }
Add Comment
Please, Sign In to add comment