This assignment is designed to practice:
The Las Vegas Tour company has decided to perform enhancements to the current version of their Processing program in order to use it to process groups of customers. The company has decided to provide a simpler package to small groups of 3 customers. Lodging and tour packages will no longer be required. The prices have been lowered also.
This requires a change to the user interface and to the program. In addition to radio buttons to select Destination and Air Travel option, three buttons will be used: Process Group, Generate Report and Clear. More details about them are provided in the Requirements section.
You will have to create some arrays and functions for the buttons to work as intended.
You are required to implement the interface required using the JavaScript programming language. The illustration below displays the GUI screen required. A template is provided to you with the basic structure of the interface.
Note: Choose a background
Figure: see image.
The new pricing list is listed below:
Destination:
Bellagio
Wynn
Destination: Bellagio or Wynn.
Air Travel: First Class or Economy.
Other Output: A Report with the details for the group. It's generated when calling the generateReport function by clicking on the Generate Report button.
Radio Buttons for Destination and Air Travel option:
Process Group button: it is clicked on to process a group of customers.
It will take care of the following tasks:
Creating the functions
Two functions are required to initialize the arrays.
They will require only one parameter for each of them. The argument passed to this parameter will be an array.
Calling the functions
Generate Report button:
The Generate Report button will call the generateReport function when it is clicked on. The Generate Report button will produce a report with the details of the group processed. (Note: a group of customers needs to be processed first before generating the report).
The generateReport function is provided inside the generateReportFunction.js file.
The generateReport function requires the following arguments in the following order:
Clear button: clears all the radio buttons and text boxes. It also resets the variables and the arrays. The same function to initialize the arrays may be used to reset the arrays.
Destination | Air Travel Option | |
Inputs: | ||
Customer 1 | Bellagio | Economy |
Customer 2 | Wynn | First Class |
Customer 3 | Bellagio | First Class |
Output: | ||
Total Price | $1475.00 | |
Final Price (includes 8% Resort Fee) | $1593.50 |
Be sure to include a comment with your name and section in the part of your HTML code program.
Since the content of a text box which requires a number may be used in mathematical operations, use the function Number() to ensure that the numeric input is treated as numeric data. Syntax example:
numericVariable = Number(myBoxID.value)
Syntax example to round up a number to 2 decimals. Just add .toFixed(2) to the variable name containing the number.
someNumber.toFixed(2)
You will use several variables in this program.
It is good practice to also store the tax rate (0.07) in a variable.
Examples related to radio buttons (these are examples, the name, id and onclick content should be related to your code):
Using radio buttons:
< input type="radio" name="size" id="large" onclick="sizeData="L"">
< input type="radio" name="size" id="small" onclick="sizeData='S"">
In the example above, the two associated radio buttons, load the appropriate value to the variable sizeData based on the user's selection.
Clearing radio buttons:
The radio buttons in the previous example may be cleared by using the following syntax in a program:
large.checked = false;
small.checked = false;
Notice that the IDs of the radio buttons are used when clearing a radio button.