程序代写代做代考 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’))

Start

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

A

A

Set countyTax =
purchase *

COUNTY_TAX_RATE

Set totalTax = stateTax
+ countyTax

Set totalSale =
purchase + totalTax

Display
“Purchase
Amount: “,
purchase

Display “State
Tax: “, stateTax

Set stateTax =
purchase *

STATE_TAX_RATE

Display
“County Tax: “,

countyTax

B

Display “Total
Tax: “, totalTax

B

Display “Sale
Total: “,

totalSale

End