2015-09-21 4 views
0

Что случилось с этой программой ставок налогов, которую я пишу, если быть точным, я пытаюсь понять, почему 2,5% не появляется в программе, когда я запускаю ее показывает, как другой процент, так вот, что у меня до сих порЧто случилось с налоговой программой python? Я написал

`

Имя сценария: Tax Program

# Author : 
# Purpose: The purpose of this program is to ask the user to enter the amount of a item purchase. 
# The program should then compute the state and county sales tax. Assume the 
# state sales tax is 5 percent and the county sales tax is 2.5 percent. The program 
# should display the amount of the purchase, the state sales tax, the county 
# sales tax, the total sales tax and the total of the sale (which is the sum of 
# the amount of purchase plus the total sales tax) 
# Use the value 0.05 and 0.025 

# Display "Enter item_price Amount" 
# Input item_price 
# Display "state tax is 5%" 
# Set state_tax= 0.05 
# Display "county_tax is 2.5%" 
# Set county_sales tax = 0.025 


county_tax = 0.025 
state_tax = 0.05 
tax_rate= county_tax + state_tax 

#Ask User to enter item price and store it in the item price varible 
item_price = float(input("Please enter the price of your item")) 
item_price =int(100* item_price) 
total_price = item_price*(1 + tax_rate) 

#Calculate item price at .05, .025, and .075 tax rate 

print("Your Purchase Amount was ${:0.2f}".format(item_price/100))  
print("Your County Tax Rate was {}%".format(int(county_tax * 1000 * 20/100))) 
print("Your State Tax Rate was{}%".format(int(state_tax * 1000 * 20/100))) 
print("Your Total Sales Cost is ${:0.2}".format(total_price/100)) 
print("Your Total Tax Rate was{}%".format(int(tax_rate * 1000 * 20/100))) 
+1

Вам нужно будет показать свои входы и то, что вы ожидали в качестве вывода, и то, что вы получили вместо этого –

+0

Почему вы делаете такой сложный расчет? И вы пытались ввести цену товара, скажем, 10? Вы получаете тогда $ 2.7e + 01' как Total Sales Cost на выходе. Я не думаю, что это то, что вы хотели бы видеть. – Psytho

ответ

0

проблема заключается в том, что вы умножения значения на 20/100 без видимой причина, поэтому отображается 0.025, то есть 2,5% * .2

Смежные вопросы