Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Tasks

Calculate the income tax and round to 2 decimal places.

Click the checkbox above to attempt this task.

Checks

Test Case Incomplete

Test for $12345.67 income and 1 dependent

Test Case Incomplete

Test for $98721.56 income and 2 dependents

Test Case Incomplete

Test for $314159.26 income and 3 dependents

#Editthecodebelow

"""

Program:taxform.py

Author:KenLambert

Computeaperson'sincometax.

1.Significantconstants

taxrate

standarddeduction

deductionperdependent

2.Theinputsare

grossincome

numberofdependents

3.Computations:

taxableincome=grossincome-thestandarddeduction-

adeductionforeachdependent

incometax=isafixedpercentageofthetaxableincome

4.Theoutputsare

theincometax

"""

#Initializetheconstants

TAX_RATE=0.20

STANDARD_DEDUCTION=10000.0

DEPENDENT_DEDUCTION=3000.0

#Requesttheinputs

grossIncome=float(input("Enterthegrossincome:"))

numDependents=int(input("Enterthenumberofdependents:"))

#Computetheincometax

taxableIncome=grossIncome-STANDARD_DEDUCTION-\

DEPENDENT_DEDUCTION*numDependents

incomeTax=taxableIncome*TAX_RATE

#Displaytheincometax

print("Theincometaxis$"+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

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions

Question

What are the contingency theories of leadership?

Answered: 1 week ago