// This program accepts any number of purchase prices // and computes state sale
ID: 3745605 • Letter: #
Question
// This program accepts any number of purchase prices // and computes state sales tax as 6% of the value // and city sales tax as 2% of the value // Modify the program so that the user enters /i the two tax rates // at the start of the program start Declarations num price num STATE TAX RATE = 0.06 num CITY TAX RATE = 0.02 num totalTax num total startUp() while price not equal to e mainLoop) endwhile finishUp() stop startUpO output "Enter a price or 0 to quit" input price return minoop) totalTaxpriceSTATE TAX RATE price CITY_TAX_RATE total price tota!Tax output "Price is ", price, "and total tax is ", totalTax output "Total is ", total output "Enter a price or 0 to quit" input price return finishUp) return output "End of program"Explanation / Answer
start
Declarations
num Price
num STATE_TAX_RATE
num CITY_TAX_RATE
num totalTax
num total
startUp()
while price is not equal to 0
mainLoop()
endwhile
finishUp()
stop
startUp()
output "Enter a price or 0 to quit"
input price
return
mainLoop()
output "Enter STATE_TAX_RATE"
input STATE_TAX_RATE
output "Enter CITY_TAX_RATE"
input CITY_TAX_RATE
totalTax = price * (STATE_TAX_RATE/100) + price * (CITY_TAX_RATE/100)
total = price + totalTax
output "Price is " , price , "and total tax is " , totalTax
output "Total is " , total
output "Enter a price or 0 to quit"
input price
return
finishUp()
output "End of program"
return
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.