CSC 115 Lab 3 Rewrite Program 1 using functions. The required functions are in the table below. Create a Python program that will calculate the user’s net pay based on their tax bracket. Your program...

I need help with a few things with the code.


CSC 115 Lab 3 Rewrite Program 1 using functions. The required functions are in the table below. Create a Python program that will calculate the user’s net pay based on their tax bracket. Your program will prompt the user for their name, their monthly gross pay, and the number of dependents. The number of dependents will determine the user’s tax bracket. The tax brackets are as follows: · 0 – 1 Dependents: Tax = 25% · 2 – 3 Dependents: Tax = 20% · 4+ Dependents: Tax = 15% After calculating the net pay, print the name of the user, the monthly gross pay, the number of dependents, the gross pay, the tax rate, and the net pay. The formula to compute the net pay is: monthly gross pay – (monthly gross pay * tax rate) Function names to use Description read_name() Reads the name entered, and returns the name. read_gross_pay() Reads the gross pay amount, and returns the amount. read_dependents() Reads the number of dependents, and returns the number. compute_tax_rate(dependents) Computes and returns the tax rate, based on the number of dependents. compute_net_pay(gross_pay, rate) Computes and returns the net pay, based on the gross pay and the tax rate. main() Main function of the program. Sample run: Enter your name: Ron Swanson Enter your gross pay: $3500 Enter number of dependents: 0 Name: Ron Swanson Gross pay: $3500.00 Dependents: 0 Tax rate: 25% Net Pay: $2625.00 def main(): read_name() gross_pay() read_dependents() compute_tax_rate() compute_net_pay() def read_name(): name = input('Enter your name: ') return name def gross_pay(): gross = int(input('Enter your gross pay: $')) return gross def read_dependents(): dep = int(input('enter number of dependents: ')) return dep def compute_tax_rate(dependents): if dependents % 0 <= 1:="" taxrate="dependents" *="" 0.25="" else:="" if="" dependents="" %="" 2=""><= 3:="" taxrate1="dependents" *="" 0.20="" else:="" if="" dependents="" %="" 4="">= 4: taxrate2 = dependents * 0.15 return dependents def compute_net_pay(gross_pay, rate): gross_pay = gross_pay() rate = compute_tax_rate(gross_pay) return gross_pay, rate main()
Oct 16, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here