Answered step by step
Verified Expert Solution
Link Copied!

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

  1. Use JavaScript code to interact with web pages with numeric operations, template strings, and arrays.

    Create a function checkout() to do the following:
    1. Ask the user for 2 room rates, one at a time, and add them to the roomRate array.
    2. Calculate the GST(5%, use 0.05), PST(8%, use 0.08), and the amount after taxes for each room.
    3. At the same time, it will also accumulate the total of the after tax amount for the rooms.
    4. 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.
    5. 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.
    HINT: Pay attention to type conversion. For this assignment, any number of decimal places would be fine. To show the values with proper decimal places, consider to use toFixed() method.
  2. 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

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

Step: 3

blur-text-image

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago