aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp
blob: c8a4bedbf2d1ebace3c7ed065d6d53200326b718 (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
/*
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;
  double SSI, MN, Fed, GroPay, NetPay;
  cout << "How many hours did you work this week?: ";
  cin >> hours;
  cout << "How many dependents do you have?: ";
  cin >> dependents;
  if (hours > 40) {
    OT=hours-40;
  }
  if (dependents >= 3) {
    Health=35;
  }
  GroPay = hours * 16.78 + OT * 16.78 * 1.5;
  SSI = GroPay * 0.06;
  Fed = GroPay * 0.14;
  MN = GroPay * .05;
  NetPay = GroPay-SSI-Fed-MN-Health-10;       //$10 union dues

  cout << fixed << setprecision(2) << "Your gross (before withholdings) pay is $" << GroPay << "." << endl
  << "Social Security withholding: $" << SSI << endl
  << "Federal income tax withholding: $" << Fed << endl
  << "State income tax withholding: $" << MN << endl
  << "Union Dues: $10" << endl
  << "Medical cost: $" << Health << endl //<< endl

  << "Your net (after witholdings) pay is $" << NetPay << "." << endl;
}