subject
Engineering, 07.04.2020 20:21 gypsybrio1512

Python Homework

Instructions:

The tax calculator program of the case study outputs a floating-point number that might show more than two digits of precision.

Use the round function to modify the program to display at most two digits of precision in the output number.

Below is an example of the program input and output:

Enter the gross income: 12345.67

Enter the number of dependents: 1

The income tax is $-130.87

# Edit the code below

"""
Program: taxform. py
Author: Ken Lambert
Compute a person's income tax.
1. Significant constants
tax rate
standard deduction
deduction per dependent
2. The inputs are
gross income
number of dependents
3. Computations:
taxable income = gross income - the standard deduction -
a deduction for each dependent
income tax = is a fixed percentage of the taxable income
4. The outputs are
the income tax
"""

# Initialize the constants
TAX_RATE = 0.20
STANDARD_DEDUCTION = 10000.0
DEPENDENT_DEDUCTION = 3000.0

# Request the inputs
grossIncome = float(input("Enter the gross income: "))
numDependents = int(input("Enter the number of dependents: "))

# Compute the income tax
taxableIncome = grossIncome - STANDARD_DEDUCTION - \
DEPENDENT_DEDUCTION * numDependents
incomeTax = taxableIncome * TAX_RATE

# Display the income tax
print("The income tax is $" + str(incomeTax))

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Draw the engineering stress-strain curve for (a) bcc; (b) fcc metals and mark important points.
Answers: 1
question
Engineering, 04.07.2019 18:10
Water at the rate of 1 kg/s is forced through a tube with a 2.5 cm inner diameter. the inlet water temperature is 15°c, and the outlet water temperature is 50°c. the tube wall temperature is 14°c higher than the local water temperature all along the length of the tube. what is the length of the tube?
Answers: 3
question
Engineering, 04.07.2019 18:20
Air is compressed isentropically from an initial state of 300 k and 101 kpa to a final temperature of 1000 k. determine the final pressure using the following approaches: (a) approximate analysis (using properties at the average temperature) (b) exact analysis
Answers: 1
question
Engineering, 04.07.2019 19:10
Agas is compressed from vi 0.3 m, p 1 bar to of v2 0.1 m3, p2--3 bar. pressure and volume are related linearly during the process. for the gas, find the work, in kj.
Answers: 2
You know the right answer?
Python Homework

Instructions:

The tax calculator program of the case study o...
Questions
Questions on the website: 13722362