Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to adjust this code to collect several employees gross pay and then calculate the total gross pay for all entered employees once the

I need to adjust this code to collect several employees gross pay and then calculate the total gross pay for all entered employees once the loop is terminated.

Here is the code I have already

employeeNum = -2 grossPay = 0.00 stateTax = 0.00 federalTax = 0.00 fica = 0.00 netPay = 0.00

while employeeNum != 0: employeeNum = int(input('Enter employee number or enter 0 to terminate loop and display results: ')) if (employeeNum == 0): break grossPay = float(input('Enter gross pay : $ ')) if grossPay < 0: grossPay = float(input('Gross pay must be greater than zero. Please re-enter: ')) stateTax = float(input('Please enter state tax : $ ')) if stateTax < 0 or stateTax > grossPay: stateTax = float(input('State tax must be greater than zero and less than gross pay. Please re-enter: ')) federalTax = float(input('Please enter federal tax : $ ')) if federalTax < 0 or federalTax > grossPay: federalTax = float(input('Federal tax must be greater than zero and less than gross pay. Please re-enter: ')) fica = float(input('Please enter FICA withholdings : $ ')) if fica < 0 or fica > grossPay: fica = float(input('FICA withholdings must be greater than zero and less than gross pay. Please re-enter: '))

netPay = grossPay - stateTax - federalTax - fica

print(' ') print('Gross pay: $', format(grossPay, '.2f')) print(' ') print('State tax: $', format(stateTax, '.2f')) print(' ') print('Federal tax: $', format(federalTax, '.2f')) print(' ') print('FICA withholdings: $', format(fica, '.2f')) print(' ') print('Net pay: $', format(netPay, '.2f')) print(' ')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

LO35.3 Describe how a bank can create money.

Answered: 1 week ago