This assignment is designed to practice:
The Las Vegas Tour company wishes to create a GUI (Graphical User Interface) to price its tour packages for customers. Radio buttons and text boxes are needed for input and output purposes. Buttons will be used for processing data.
You are required to create a webpage to implement the interface required using the JavaScript programming language. The illustration below displays the GUI screen required.
Figure: see image.
Note: Choose a background color and a text color of your preference
As a reminder, the pricing list is listed below:
Destination:
Bellagio
Wynn
Destination: Bellagio or Wynn.
Air Travel: First Class or Economy.
Hotel: Number of nights.
Tour: High Roller or Basic.
Process button:
Clear button:
Sample 1 | Sample 2 | |
Inputs: | ||
Destination | Bellagio | Wynn |
Air Travel | Economy | First Class |
Hotel nights | 7 | 5 |
Tour | Basic | High Roller |
Output: | ||
Total Price | $3000.00 | $4500.00 |
Final Price (includes 8% resort free) | $3240.00 | $4860.00 |
Be sure to include a comment with your name and section in the < head> 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 store the resort fee (0.08) 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.