From 123ca503b1489a4fde7bdfa88d6044fa09500eb5 Mon Sep 17 00:00:00 2001 From: Matthew Strapp Date: Wed, 13 Feb 2019 15:42:53 -0600 Subject: Fix sneaky --- ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ee1301/wk2') diff --git a/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp b/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp index 431f11c..048e1b1 100644 --- a/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp +++ b/ee1301/wk2/lab2/strap012_lab2_pay_stub.cpp @@ -13,7 +13,7 @@ Short Program Description: Pay Stub Calculator using namespace std; int main () { - int Dependents, Hours; + int Dependents, Hours, Union; 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?: "; @@ -30,8 +30,10 @@ int main () { SocSec = GrossPay * 0.06; Fed = GrossPay * 0.14; State = GrossPay * .05; - NetPay = GrossPay-SocSec-Fed-State-Health-10; //$10 union dues are constant - + if (GrossPay>0){ + Union=10; + } + NetPay = GrossPay-SocSec-Fed-State-Health-Union; //$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 -- cgit v1.2.3