Question: Question 3-JAVASCRIPT (20 Marks) (a) Write the JavaScript codes for the get total) function that displays the amount to be paid for the purchase of

 Question 3-JAVASCRIPT (20 Marks) (a) Write the JavaScript codes for the
get total) function that displays the amount to be paid for the

Question 3-JAVASCRIPT (20 Marks) (a) Write the JavaScript codes for the get total) function that displays the amount to be paid for the purchase of an ice-cream cone. [10 marks] A form named "forml" has the following elements. input type-"checkbox name-"addon value-SS onclick-"get total Strawberry Sauce (RM 1.00) Peanuts (RM 0.30) Salty Caranel (RM 0.50 Cp>Total RM p>

Choice of Toppings: xp> In function get total0: o o Declare all the variables used in the program. Using a for loop: Identify whether each checkbox is checked. . If the checkbox is checked, add the topping code into an array Using another for loop: o Use a switch case statement to get each topping code from the array and identify the name and price. Write a formula so that the total payment can be calculated Display the total payment and the selected toppings as shown in the sample output o SAMPLE OUTPUT If no toppings were chosen, the total will be the standard ice-cream price which is RM3.50 Standard Price: RM3.50 Add Toppings? Strawberry Sauce (RM 1 .00) OPeanuts (RM 0.30) Chocolate Chips (RM 0.80) OSalty Caramel (RM0.so) Total : RM3.50 Choice of Toppings No Toppings Chosen If the toppings were chosen, the total with the addition of the topping prices will be displayed. The chosen topping names will also be displayed. Standard Price: RM 3.50 Add Toppings? Strawberry Sauce (RM 1.00) Peanuts (RM 0.30) Chocolate Chips (RM 0.80) Salty Caramel (RM 0.50) Total: RM 6.10 Choice of Toppings Strawberry Sauce Peanuts Chocolate Chips Salty Caramel .If the check boxes are removed, the price will be decreased. Standard Price: RM 3.50 Add Toppings? Strawberry Sauce (RM 1.00) Peanuts RM 0.30) Chocolate Chips (RM 0.80) Salty Caramel (RM 0.50) Total: RM 4.30 Choice of Toppings Peanuts Salty Caramel

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 Databases Questions!