1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lubov Fominskaja [6]
3 years ago
7

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

Computers and Technology
1 answer:
Aneli [31]3 years ago
4 0

Answer:

TAX_RATE = 0.20

STANDART_DEDUCTION = 10000.0

DEPENDENT_DEDUCTION = 3000.0

gross_income = float(input("Enter the gross income: "))

number_of_dependents = int(input("Enter the number of dependents: "))

income = gross_income - STANDART_DEDUCTION - (DEPENDENT_DEDUCTION * number_of_dependents)

tax = income * TAX_RATE

print ("The income tax is $" + str(round(tax, 2)))

Explanation:

Define the <em>constants</em>

Ask user to enter the <em>gross income</em> and <em>number of dependents</em>

Calculate the <em>income</em> using formula (income = gross_income - STANDART_DEDUCTION - (DEPENDENT_DEDUCTION * number_of_dependents))

Calculate the <em>tax</em>

Print the <em>tax</em>

<em />

round(number, number of digits) -> This is the general usage of the <em>round</em> function in Python.

Since we need <u>two digits of precision</u>, we need to modify the program as str(<u>round(incomeTax, 2</u>)).

You might be interested in
Suppose you wanted to run a web server or ftp server from your home. what type of ip address would you want?​
Greeley [361]
You would need to have a static ip address.
3 0
3 years ago
A cookie recipe calls for the following ingredients: • 1.5 cups of sugar • 1 cup of butter • 2.75 cups of flour The recipe produ
True [87]

The program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient is corresponds to the ingredients mentioned above.

<h3>Further explanation</h3>

Python is a general-purpose programming language. We want to write a python program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient.

48 cookies = 1.5 cups of sugar + 1 cup of butter + 2.75 cups of flour, so:

def main():

   cookies = float(input("How many cookies would you like to make?\n>"))

   sugar = (1.5 * cookies) / 48.0

   butter = cookies / 48

   flour = (2.75 * cookies) / 48

   print("To make ", cookies, " cookies, you will need:\n", \

         format(sugar, '.2f'), " cups of sugar\n", \

         format(butter, '.2f'), " cups of butter\n", \

         format(flour, '.2f'), " cups of flour", sep='')

   redoQuery()  

def redoQuery():

   yn = input("Would you like to check another batch size? (y/n)\n>")

   if yn == 'y':

       main()

   elif yn =='n':

       exit()

   else:

       print("Please enter only a lowercase \'y\' or lowercase \'n\'," \

             "then press enter")

       redoQuery()

main()

The run program is shown in the attachment below.

<h3>Learn more</h3>

1. Learn more about python https://brainly.in/question/8049240

 

<h3>Answer details</h3>

Grade:  9

Subject: Computers and Technology

Chapter:  programming with python

Keywords: python

4 0
3 years ago
Multiple Choice
natta225 [31]

Answer:

information technology

6 0
3 years ago
Read 2 more answers
Why is the GPS so important today?
SIZIF [17.4K]

It allows us to precisely tell where places, people (under certain circumstances), etc. are. It is the most widely relied upon mapping system in the world. Using a GPS, you can find almost any plotted (known) location on the Earth. Most mapping operations rely on a GPS and would, otherwise, fail without it.

7 0
3 years ago
If you were an attacker who wanted to gain access to a network, would you focus on breaching technical controls for applying soc
katrin2010 [14]

Answer:

Baiting. As its name implies, baiting attacks use a false promise to pique a victim's greed or curiosity. ...

Scareware. Scareware involves victims being bombarded with false alarms and fictitious threats. ...

Pretexting. Here an attacker obtains information through a series of cleverly crafted lies. ...

Phishing. ...

Spear phishing

Explanation:

thank me later

7 0
3 years ago
Other questions:
  • The 3rd generation programming language that most students learned when most computers used MS DOS was ___ . It remains a safe p
    12·1 answer
  • What is a Limited Purpose credit card
    11·2 answers
  • The camera on a phone or laptop can be used to track a user's eye movements. Which of these is NOT one of the possible applicati
    13·1 answer
  • A Write about why it is important for a person to upgrade their job skills
    14·1 answer
  • Which magazine can help the public to determine the best technology to buy?
    14·1 answer
  • BI is an umbrella term that combines architectures, tools, databases, analytical tools, applications, and methodologies. b. BI i
    10·1 answer
  • Why should we be concerned about HVAC systems when discussing security?
    7·1 answer
  • Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
    8·1 answer
  • What are the 5 characteristics of flowchart<br>​
    14·1 answer
  • Is mayonnaise technically an instrument?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!