Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm working in python. I can't get the final portion to format correctly. I'm not sure what I'm doing wrong. ''' Assignment 1 - Boxmart

image text in transcribedI'm working in python. I can't get the final portion to format correctly. I'm not sure what I'm doing wrong.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

''' Assignment 1 - Boxmart Payroll

This script will on input of an employee name, number of hours worked, and a position code, compute and print a pay stub and a pay check for the employee. Rules for computation are as follows:

1. Hourly rate is determined by a position code where a cashier is paid $ 12.25/hr, clerk is paid $ 18.00/hr, and manager is paid $ 25.75/hour. 2. If the position code is not one of above, then print "Invalid code", and exit() 3. For everyone except for managers, the hours over 40 in a week are considered to be overtime hours (note normal hours of non-manager's can be at most 40). 4. Normal pay is normal hours times hourly rate. 5. Overtime pay is overtime hours times hourly rate times 1 1/2. 6. Gross pay is the sum of normal pay and overtime pay. 7. Federal tax is 10% of gross pay in excess of 500. 8. State tax is 3% of gross pay. 9. Net pay is gross pay less federal tax and less state tax. 10. Use start_date and end_date functions from the pay_period module to get the pay period dates. See module pay_period.py. 11. Use the pay_date function from the pay_period module to get the date of the check. See module pay_period.py.

Created on Feb 20, 2020

@author: ''' from pay_period import *

name = input("Enter employee name: ") hours = int(input("Enter hours worked: ")) code = input("Enter position code: ")

# TODO add calculations pay = 0

if code == "cashier": pay = 12.25 elif code == "clerk": pay = 18 elif code == "manager": pay = 25.75 else: print("Invalid Code") exit()

if hours > 40: normal_hours = 40 over_worked_hours = hours - 40 else: normal_hours = hours over_worked_hours = 0

normal_pay = normal_hours * pay over_worked_pay = pay * 1.5 * over_worked_hours gross_pay = normal_pay + over_worked_pay

federal_tax = 0 if gross_pay > 500: federal_tax = (gross_pay - 500) * 0.10

state_tax = gross_pay * 0.03 net_pay = gross_pay - (federal_tax + state_tax)

print(" BoxMart Pay Stub") print() print(f"Employee Name: {name}")

# TODO complete print print("Pay Period: ", start_date(), 'to', end_date()) print() print("%-35s%s%d hrs" % ("Normal Hours Worked:", "", normal_hours)) print("%-35s%s%d hrs" % ("Overtime Hours Worked:", "", over_worked_hours)) print("%-35s%s%0.2f/hr" % ("Hourly Wages:", "$ ", pay)) print() print("%-35s%s%0.2f" % ("Normal Pay:", "$ ", normal_pay)) print("%-35s%s%0.2f" % ("Overtime Pay:", "$ ", over_worked_pay)) print("%-35s%s%0.2f" % ("Gross Pay:", "$ ", gross_pay)) print("%-35s%s%0.2f" % ("Federal Tax:", "$ ", federal_tax)) print("%-35s%s%0.2f" % ("State Tax:", "$ ", state_tax)) print("%-35s%s%0.2f" % ("Net Pay:", "$ ", net_pay)) print() print("%-35s%s" % ("Box Mart, Inc.", pay_date())) print("%s%-30s%s%0.2f" % ("Pay to: ", name, "$ ", net_pay))

Pay Period Import

def start_date():

return '01/14/2020'

def end_date():

return '01/20/2020'

def pay_date():

return '01/27/2020'

This module provides functions to access dates used for a printing a pay stub and pay check of the BoxMart Payroll program. Functions are: start_date() - return the start date of the current pay period. end_date() - return the end date of the current pay period. pay_date() - return the pay check date of the current pay period. This version of the module is provided for testing purposes as dates returned are hard coded stubs. Created on Feb 20, 2020 Cauthor: David T. Smith def start_date(): return 01/14/2020 def end_date(): return 01/20/2020 def pay_date(): return 01/27/2020 12.1 BoxMart Payroll BoxMart wants a new payroll application to generate pay stubs and pay checks for its employees. The program is to prompt for the employee name, the hours worked in a week, and a position code. Calculations are as follows: 1. Hourly rate is determined by a position code where a cashier is paid $ 12.25/hr clerk is paid $ 18.00/hr, and manager is paid $ 25.75/hour. 2. If the position code is not one of above, then print "Invalid code", and exit(). 3. For everyone except for managers, the hours over 40 in a week are considered to be overtime hours (note normal hours of non-manager's can be at most 40). 4. Normal pay is normal hours times hourly rate. 5. Overtime pay is overtime hours times hourly rate times 1 %. 6. Gross pay is the sum of normal pay and overtime pay. 7. Federal tax is 10% of gross pay in excess of 500 8. State tax is 3% of gross pay. 9. Net pay is gross pay less federal tax and less state tax. 10. Use start date and end date functions from the pay period module to get the pay period dates. These functions will return a string. 11. Use the pay date function from the pay period module to get the date of the check. This function will return a string. Enter employee name: John Smith Enter hours worked: 45 Enter position code: cashier BoxMart Pay Stub Employee Name: John Smith Pay Period: 01/14/2020 to 01/20/2020 Normal Hours Worked: Overtime Hours Worked: Hourly Wage: 40 hrs 5 hrs 12.25/hr $ Normal Pay: Overtime Pay: Gross Pay: Federal Tax: State Tax: Net Pay: $ 490.00 $ 91.88 $ 581.88 $ 8.19 $ 17.46 $ 556.23 Box Mart, Inc. 01/27/2020 Pay to: John Smith $ 556.23 BOXMart Pay Employee Name: John Smith Pay Period: 01/14/2020 to 01/20/2020 Normal Hours Worked: 40 Overtime Hours Worked: 5 Hourly Wage: Your output starts with $ 12.25/hr Normal Pay: Overtime Pay: Gross Day: Federal Tax: State Tax : Net Day: $ $ $ $ $ 490.00 91.88 581.88 8.19 17.46 556.23 $ Box Mart, Inc. 01/27/2020 Pay to: John Smith $ 556.23 Enter employee name: Enter hours worked: Enter position code: BoxMart Pay Stub Employee Name: John Smith Pay Period: 01/14/2020 to 01/20/2020 Expected output starts with Normal Hours Worked: Overtime Hours Worked: Hourly Wage: 40 hrs 5 hrs 12.25/hr $ $ Normal Pay: Overtime Pay: Gross Pay: Federal Tax: State Tax: Net Day: $ $ $ 490.00 91.88 581.88 8.19 17.46 556.23 $ $ from pay-period import * name = input("Enter employee name: ") hours = int(input("Enter hours worked: ")) code = input("Enter position code: ") # TODO add calculations = 0 pay if code == "cashier": pay = 12.25 elif code == "clerk": pay = 18 elif code == "manager": pay = 25.75 else: print("Invalid Code") exit() if hours > 40: normal_hours = 40 over_worked_hours = hours - 40 else: normal_hours = hours over_worked_hours = 0 normal_pay = normal_hours * pay over_worked_pay = pay * 1.5 * over_worked_hours gross_pay = normal_pay + over_worked_pay federal_tax = 0 if gross_pay > 500: federal_tax = (gross_pay 500) * 0.10 state_tax = gross_pay * 0.03 net_pay = gross_pay - (federal_tax + state_tax) print("In BoxMart Pay Stub") print() print(f"Employee Name: {name}") # TODO complete print print("Pay Period: ", start_date(), 'to', end_date() print() print("%-35s%s%d hrs" % ("Normal Hours Worked:", normal_hours)) print("%-35s%s%d hrs" % ("Overtime Hours Worked:", ": over_worked_hours)) print("%-35s%s%0.2f/hr" % ("Hourly Wages:", pay)) print() print("%-35s%s%0.2f" % ("Normal Pay:", "$ normal_pay)) print("%-35s%s%0.2f" % ("Overtime Pay:", "$", over worked_pay)) print("%-35s%s%0.2f" % ("Gross Pay:", "$" gross_pay)) print("%-35s%s%0.2f" % ("Federal Tax:", federal_tax)) print("%-35s%s%0.2f" % ("State Tax:", state_tax)) print("%-35s%s%0.2f" % ("Net Pay:", "$", net_pay)) print() II "$ 1 $

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

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions

Question

Describe marketing uses of branding AppendixLO1

Answered: 1 week ago

Question

1. Answer the question, What is human resource management?

Answered: 1 week ago

Question

Discuss the importance of workforce planning.

Answered: 1 week ago

Question

Differentiate between a mission statement and a vision statement.

Answered: 1 week ago