@bobbywjamc/BlushingStrongEditors
C++

No description

Files
  • main.cpp
main.cpp
/*
Problem: Calculate and print the monthly paycheck for an employee given a list of deductions.

Algorithm
1. Get Employee Name
2. Get Gross Income
3. Calculate all deductions
4. Output all deductions to two decimal places
a. Left align name of all outputs
b. Right align all numerical values with their respective name
*/


#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main()
{

	//Variable Declaration and Initialization 

	string employeeFullName;
	double grossIncome;
	double fedTax = .15;
	double fedDeduction;
	double stateTax = .035;
	double stateDeduction;
	double ssTax = .0575;
	double ssDeduction;
	double medTax = .0275;
	double medDeduction;
	double pensionTax = .05;
	double pensionDeduction;
	double healthInsurance = 75.00;
	double netPay;


	//Input	


	cout << "Please Enter Employee's Full Name:" << endl;
	getline(cin, employeeFullName);
	cout << "Please Enter Employee's Gross Income (ex. 75876.34):" << endl;
	cin >> grossIncome;


	//Process
	fedDeduction = grossIncome * fedTax;
	stateDeduction = grossIncome * stateTax;
	ssDeduction = grossIncome * ssTax;
	medDeduction = grossIncome * medTax;
	pensionDeduction = grossIncome * pensionTax;
	netPay = grossIncome - fedDeduction - stateDeduction - ssDeduction - medDeduction - pensionDeduction;




	//Output

	cout << "***********************************************************" << endl;
	cout << "Net Pay is calculated after taking the following deductions" << endl;
	cout << "Federal Income Tax: 15%" << endl;
	cout << "State Tax: 3.5%" << endl;
	cout << "Social Security Tax: 5.75%" << endl;
	cout << "Medicare/Medicaid Tax: 2.75%" << endl;
	cout << "Pension Plan: 5%" << endl;
	cout << "Health Insurance: $75.00" << endl;
	cout << "***********************************************************\n\n\n" << endl;

	cout << "TOTAL DEDUCTIONS for " << employeeFullName << endl;
	cout << "----------------------------------------------------" << endl;
	cout << fixed << setprecision(2);
	cout << setfill('.') << setw(40) << left << "Gross Amount: "
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << grossIncome << endl;
	cout << setfill('.') << setw(40) << left << "Federal Tax Deduction: "
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << fedDeduction << endl;
	cout << setfill('.') << setw(40) << left << "State Tax Deduction: " 
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << stateDeduction << endl;
	cout << setfill('.') << setw(40) << left << "Social Security Tax Deduction: " 
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << ssDeduction << endl;
	cout << setfill('.') << setw(40) << left << "Medicare/Medicaid Tax Deduction: " 
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << medDeduction << endl;
	cout << setfill('.') << setw(40) << left << "Pension Plan Deductions: "
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << pensionDeduction << endl;
	cout << setfill('.') << setw(40) << left << "Health Insurance Deduction: " 
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << healthInsurance << endl;
	cout << setfill('.') << setw(40) << left << "Net Pay: " 
		 << setw(2) << " $"
		 << setfill(' ') << setw(8) << right << netPay << endl;


	return 0;
}
gcc version 4.6.3