Question: Write a JavaScript program that calculates the sales tax and total price of an item. Assume a sales tax rate of 8%, which means you
Write a JavaScript program that calculates the sales tax and total price of an item. Assume a sales tax rate of 8%, which means you will multiply the cost of the item by .08 in order tocalculate the tax amount. Use prompt and parseFloat to ask the user to input the items cost and convert it to a numeric format. Declare a variable salesTax and use the formula above to calculate the sales tax amount. Declare a variable totalCost, add the items cost plus the sales tax amount, and store it in totalCost. Output the Item cost, tax amount, and total cost on separate lines in the form of a receipt.
1. you must use prompt
2. You must declare variables
3. You must use document.write or Alert output
4. You must use parseFloat
6. You must NOT use console.log, Input, Type, Events or functions - These are advanced topics. This was not part of the lecture.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
