Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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))

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

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

More Books

Students also viewed these Programming questions