Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions

Question

What is project success?

Answered: 1 week ago