50,896 views
38 votes
38 votes
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.

User Manachi
by
2.5k points

1 Answer

13 votes
13 votes

Answer:

Step-by-step explanation:

The following code is written in Python. The tax calculator program was not provided, therefore I created a tax calculator that takes in the total price as an input and adds a 7% tax to it. Then it uses the round() function to make sure that the total is outputted as a decimal with two decimal digits at most.

def taxCalculator(price):

total = price * 1.07

formattedTotal = round(total, 2)

return formattedTotal

The tax calculator program of the case study outputs a floating-point number that-example-1
User Hesolar
by
3.1k points