Question: Instructions: Create a script that totals purchases and adds tax. In index.html file: Enter your name and today's date where indicated in the comment section

Instructions: Create a script that totals purchases and adds tax.
In index.html file:
Enter your name and today's date where indicated in the comment section in the
document head.
Add a script element to create reference to script.js file in index.html file.
In script.js file:
Enter your name and today's date where indicated in the comment section in the
document head.
Declare the following constants with their initial values:
CHICKEN_PRICE =10.95
HALIBUT_PRICE =13.95
BURGER_PRICE =9.95
SALMON_PRICE =18.95
SALAD_PRICE =7.95
SALES_TAX =0.07.
Create the calcTotal() function containing the following:
Declare the cost variable with an initial value of 0.
Declare the buyChicken variable equal to the checked property of the
element with the id "chicken". In the same way, declare the buyHalibut,
buyBurger, buySalmon, and buySalad variables equal to the checked
property of elements with ids of "halibut", "burger", "salmon", and
"salad", respectively.
Use a comparison operator to increase the value of the cost variable by the
value of the CHICKEN_PRICE constant if buyChicken is true or by 0 if
otherwise (see Figure 2-21 as an example of your code). Do the same for
the buyHalibut, buyBurger, buySalmon, and buySalad variables,
increasing the value of total cost by the value of HALIBUT_PRICE,
BURGER_PRICE, SALMON_PRICE, and SALAD_PRICE, respectively.
Set the innerHTML property for the element with the id "foodTotal" to the
value returned by the formatCurrency() function using cost as the
parameter value.
Declare the tax variable, setting its value equal to the cost variable
multiplied by SALES_TAX.
" Set the innerHTML property for the element with the id "foodTax" to the
value returned by the formatCurrency() function using tax as the
parameter value.
Declare the totalCost variable, setting its value equal to the cost variable
plus the tax variable.
Set the innerHTML property for the element with the id "totalBill" to the
value returned by the formatCurrency() function using totalCost as the
parameter value.Add an event listener to catch when the submit button is
clicked. Hint: When clicked, it will execute the calcTotal()
Insert an event handler that runs the calcTotal() function when the element with id
"chicken" is clicked. Repeat this for the elements with the id "halibut", "burger",
"salmon", and "salad".
Execute the program and take screen capture of output.
Instructions: Create a script that totals

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!