-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaxesFunctions.py
More file actions
48 lines (39 loc) · 2.3 KB
/
TaxesFunctions.py
File metadata and controls
48 lines (39 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#USING FUNCTIONS
"""
The problem is to write a program that will ask the user to enter
the amount of a purchase. The program should then compute the
state and county sales tax. Afterwards, the program should display
the amount of the purchase, the state tax, county tax, total sales
tax, and the total of the sale.
"""
# Input
#original_price = float(input('What is the price of the item? : ')) # Get the starting price
STATE_TAX = 0.05 # State tax for 5%
COUNTY_TAX = 0.025 # County tax for 2.5%
# Processing
#State_Price = original_price * STATE_TAX # Find the price of state tax
#County_Price = original_price * COUNTY_TAX # Find the price of county tax
#Final_Price = original_price + State_Price + County_Price # Find the final price after adding the tax
# Output
#print('Price before taxes: $', format(original_price, ',.2f'), sep='') # Print the original price
#print('State Tax: ', format(STATE_TAX, '.0%')) # Print the state tax amount
#print('County Tax: ', format(COUNTY_TAX, '.1%')) # Print the county tax amount
#print('Total Tax: $', format(State_Price + County_Price, ',.2f'), sep='') # Print total tax amount
#print('Price after taxes: $', format(Final_Price, ',.2f'), sep='') # Print the final price after tax
def main():
original_price = float(input('What is the price of the item? : '))
print('Price before taxes: $', format(original_price, ',.2f'), sep='') # Print the original price
print('County Tax: ', format(county(original_price), '.1%')) # Print the county tax amount
print('State Tax: ', format(state(original_price), '.0%')) # Print the state tax amount
print('Total Tax: $', format(state(original_price) + county(original_price), ',.2f'), sep='') # Print total tax amount
print('Price after taxes: $', format(final(original_price), ',.2f'), sep='') # Print the final price after tax
def county(original_price):
County_Price = original_price * COUNTY_TAX # Find the price of county tax
return County_Price
def state(original_price):
State_Price = original_price * STATE_TAX # Find the price of state tax
return State_Price
def final(original_price):
Final_Price = original_price + state(original_price) + county(original_price) # Find the final price after adding the tax
return Final_Price
main()