Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python progeaming this is a formatign a problem my code runs perfectly i just need it to look like this input Enter employee's name: employeeName
python progeaming this is a formatign a problem my code runs perfectly i just need it to look like this
input
Enter employee's name: employeeName Enter number of hours worked in a week: 40 Enter hourly pay rate: 12.75 Enter federal tax withholding rate (ex. 0.12): 0.11 Enter state tax withholding rate (ex. 0.06): 0.07
output
EmployeName PAY INFORMATION Pay Hours Worked: 40 Pay Rate: $ 12.75 Gross Pay: $ 510.00 Deductions Federal Withholding (11.0%): $ 56.10 State Withholding (7.0%): $ 35.70 Total Deduction: $ 91.80 Net Pay: $ 418.20
what i have so far name = input("Enter Employee's name: ") hrs = int(input("Enter number of hours worked in week: ")) pay = float(input("Enter hourly pay rate: ")) fedTax = float(input("Enter federal tax withholding rate: ")) stateTax = float(input("Enter state tax withholding rate: ")) gross = hrs * pay fedDeduct = fedTax * gross stateDeduct = stateTax * gross totDeduct = fedDeduct + stateDeduct netPay = gross - totDeduct print("Employee name: " + name) print("Hours worked: ", hrs) print("Pay rate: $", pay) print("Gross pay: $", gross) print("Deductions: ") print("\tFederal withholding ({0:.2f}%): ".format(fedDeduct) + "${0:.2f}".format(fedDeduct)) print("\tState withholding ({0:.2f}%): ".format(stateDeduct) + "${0:.2f}".format(stateDeduct)) print("\tTotal deductions: $%.2f" % totDeduct) print("Net Pay: $", netPay)
criteria
- The first 5 lines are asking for input from the user.
- Notice the form tax rates are entered compared to how they're displayed.
- Notice the alignment/formatting of the output
- Headings of sections are centered and spaces between sections
- Main output header is all capitalized
- Output numbers are right-aligned with decimals aligned
- Colons and $ signs are aligned on output
- No arithmetic calculations inside the print string (use variables)
- A single print statement is used for output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started