[Tutor] HELP!

Mark Rourke mark.rourke7 at gmail.com
Sun Sep 30 21:31:47 CEST 2012


hello, I am a college student in my first year of computer programming, 
I was wondering if you could look at my code to see whats wrong with it.

# Mark Rourke
# Sept 29, 2012
# Write a program to calculate the sales tax at the rate of 4% and 2% 
respectively
# Thereafter compute the total sales tax (sum of the state tax and the 
county tax)
# and the total purchase amount (sum of the purchase amount and the 
total sales tax).
# Finally, display the amount of purchase, the state sales tax, the 
county sales tax,
#the total sales tax and the total amount of the sale.

#Variable Declarations
#Real purchaseAmount, stateSalesTax, countySalesTax, totalSalesTax, 
totalPurchaseAmount
#Constant Real SALES_TAX = 0.4, COUNTY_TAX = 0.02

#Display "Input Purchase Amount: $"

#input the hours worked and hourly wage wage

SALES_TAX = 0.4

COUNTY_TAX = 0.02
print("----------------------------------------------------------")
print(("This program calculates the sales tax at the rate of 4% and 2% 
respectively, as well sum of the state tax"))
print("----------------------------------------------------------")

purchaseAmount = input("Please input the Purchase Amount: $")

#Calculate the State Sales Tax, County Sales Tax, Total Sales Tax, Total 
Purchase Amount

purchaseAmount = int(purchaseAmount)

stateSalesTax = int(purchaseAmount * SALES_TAX)

countySalesTax = int(purchaseAmount * COUNTY_TAX)

totalSalesTax = int(stateSalesTax + countySalesTax)

totalPurchaseAmount = int(purchaseAmount + totalSalesTax)

#Output the results

Display ("Purchase Amount:$") purchaseAmount
Display ("The State Sales Tax $") SALES_TAX
Display ("The County Sales Tax: $") COUNTY_TAX
Display ("The Total Sales Tax: $") totalSalesTax
Display ("The Total Amount of the Purchase: $") totalPurchaseAmount

-- 

Mark Rourke

T: 705-728-6169
M: 705-331-0175
E: Mark.Rourke7 at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120930/bcfa6c04/attachment.html>


More information about the Tutor mailing list