程序代写代做代考 Programming Exercise 2-6

Programming Exercise 2-6

# Variable declarations
purchase = 0.0
stateTax = 0.0
countyTax = 0.0
totalTax = 0.0
totalSale = 0.0

# Constants for the state and county tax rates
STATE_TAX_RATE = 0.05
COUNTY_TAX_RATE = 0.025

# Get the amount of the purchase.
purchase = float(input(“Enter the amount of the purchase: “))

# Calculate the state sales tax.
stateTax = purchase * STATE_TAX_RATE

# Calculate the county sales tax.
countyTax = purchase * COUNTY_TAX_RATE

# Calculate the total tax.
totalTax = stateTax + countyTax

# Calculate the total of the sale.
totalSale = purchase + totalTax

# Print information about the sale.
print (“Purchase Amount:”, format(purchase, ‘.2f’))
print (“State Tax:”, format(stateTax, ‘.2f’))
print (“County Tax:”, format(countyTax, ‘.2f’))
print (“Total Tax:”, format(totalTax, ‘.2f’))
print (“Sale Total:”, format(totalSale, ‘.2f’))

B
Display “Total Tax: “, totalTax
Display “Sale Total: “, totalSale
Declare Real purchase, stateTax, countyTax, totalTax, totalSale
Constant Real STATE_TAX_RATE = 0.05
Constant Real COUNTY_TAX_RATE = 0.025
Display “Enter the amount of the purchase.”
Input purchase
Set stateTax = purchase * STATE_TAX_RATE
A
Display “Purchase Amount: “, purchase
Set totalSale = purchase + totalTax
Set totalTax = stateTax + countyTax
Set countyTax = purchase * COUNTY_TAX_RATE
Display “State Tax: “, stateTax
Display “County Tax: “, countyTax
Start

A
B

End