blob: 431f11cbe8a1149bdbac7d25c3551cb406b94aae (
plain) (
blame)
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
|
/*
Date: 13 Feb 2019
Name: Matthew Strapp
Student ID number: 5449340
Course number: EE1301
Term: Spring 2019
Lab/assignment number: Workout
Short Program Description: Pay Stub Calculator
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
int Dependents, Hours;
int OT = 0; int Health = 0; //Set values to zero to prevent problems
double SocSec, State, Fed, GrossPay, NetPay;
cout << "How many hours did you work this week?: ";
cin >> Hours;
cout << "How many dependents do you have?: ";
cin >> Dependents;
if (Hours > 40) { //Every hour over 40 constitutes as overtime
OT=Hours-40;
}
if (Dependents >= 3) { //More than 3 dependents carries a fee
Health=35;
}
GrossPay = Hours * 16.78 + OT * 16.78 * 1.5;
SocSec = GrossPay * 0.06;
Fed = GrossPay * 0.14;
State = GrossPay * .05;
NetPay = GrossPay-SocSec-Fed-State-Health-10; //$10 union dues are constant
cout << fixed << setprecision(2) << "Your gross (before withholdings) pay is $" << GrossPay << "." << endl
<< "Social Security withholding: $" << SocSec << endl
<< "Federal income tax withholding: $" << Fed << endl
<< "State income tax withholding: $" << State << endl
<< "Union Dues: $10" << endl
<< "Medical cost: $" << Health << endl
<< "Your net (after witholdings) pay is $" << NetPay << "." << endl;
}
|