Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Jill has written a program that computes the sales tax on the purchase of an item, given the price of the item ( a floating
Jill has written a program that computes the sales tax on the purchase of an item, given the price of the item a floatingpoint number and the percent tax rate an integer The output of the program is the purchase price, the tax, and the total amount to be paid. Here is her code:
purchasePrice floatinputEnter the purchase price as $:
taxRate intinputEnter the tax rate as :
tax purchasePrice taxRate
totalOwed purchasePrice tax
printPurchase price: purchasePrice
printTax: tax
printTotal owed: totalOwed
When she tested his program with a purchase price of $ and a sales tax of Jill observed the following unexpected output:
Enter the purchase price as $:
Enter the tax rate as :
Purchase price:
Tax:
Total owed:
Determine what causes this error and fix it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started