Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use JavaScript code to interact with web pages with numeric operations, template strings, and arrays. Create a function checkout() to do the following: Ask the
-
Use JavaScript code to interact with web pages with numeric operations, template strings, and arrays.
Create a function checkout() to do the following:- Ask the user for 2 room rates, one at a time, and add them to the roomRate array.
- Calculate the GST(5%, use 0.05), PST(8%, use 0.08), and the amount after taxes for each room.
- At the same time, it will also accumulate the total of the after tax amount for the rooms.
- The input room rates and the calculation result will be added to an html string which will be assigned to an element's innerHTML property.
- Write a JS statement to get hold of the main element of the page, then assign the html string to the element's innerHTML property.
- Add a button to the main element of the rooms page (in HTML). When it's clicked on, the checkout function will be called. HINT: Add the onclick attribute to the button in html: onclick="call the checkout function".
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