-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLab 1 Payday.cpp
36 lines (32 loc) · 1.2 KB
/
Lab 1 Payday.cpp
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
#include <iostream>
int main()
{
//constants and variables are listed below
const double federalTax = 0.14;
const double socialSecurity = 0.06;
const double stateTax = 0.05;
const double unionFees = 10.00;
const double salary = 16.78;
//floating point data: double
double hours;
double dependents;
double grossPay;
double weeksPay;
//Permits infinite loop of the below code based on Boolean variable (true/false)
while(true){
std::cout << "Enter hours worked here--" << std::endl;
std::cin >> hours;
std::cout << "Enter number of dependents here--" << std::endl;
std::cin >> dependents;
if (hours > 40)
grossPay = (40 * salary) + ((hours - 40) * (1.5 * salary));
else
grossPay = (hours * salary);
if (dependents > 2)
weeksPay = grossPay - (grossPay * federalTax) - (grossPay * socialSecurity) - (grossPay * stateTax) - unionFees - 35;
else
weeksPay = grossPay - (grossPay * federalTax) - (grossPay * socialSecurity) - (grossPay * stateTax) - unionFees;
std::cout << "Your total payment for this week is--" << weeksPay << std::endl;
}
return 0;
}