Your page will simulate a pretty low key pizza shop.
Here is the overview of the page:
Heading e.g. "Paulie's Perfect PIzza"
Have a couple of text boxes to hold the person's name and their address (email)
For size, use a select box. Here are the options:
Small (costs $10 before toppings)
Medium ($14)
Large ($17)
In your HTML code, set the value for these select options to "small", "medium", and "large" respectively.
Three checkboxes for toppings:
Mushrooms
Sausage
Pepperoni
Notify the user that each topping is $1.50 (see my image above).
Offer them a 10% discount if they are willing to be added to the company mailing list. Have two radio buttons, one for "Yes" and one for "No".
A button that says: "Make My PIzza!" . NOTE: As we've done previously, to create your button, do not use the <input type="button">
option. Instead, you use the <button>
tag.
A div section to hold the output
Given the above information, the cost calculation should be fairly straight-forward. Start with the cost based on their choice for the size of their pizza. .
Begin by examining the select box for the size. Note that there are 3 options. You MUST use else if
to see which of the three select sizes they chose. That is, do not use three separate if
statements.
If they clicked on "Yes" for the mailing list radio buttton, deduct 10% from their cost.
Discount based on whether or not they agreed to be added to the mailing list.
Output to a div section as usual. Output the cost to 2 decimal places. Your output should include their name and the cost. Your output should follow this format:
Thank you, <name>, for your order! Your total cost is $<cost>.
Your output should match mine as shown in the examples below. (e.g. include the dollar sign, and the period at the end of each sentence). Also notice that there is a comma before and after the name.
Your JavaScript code should be placed in an external JS file.
Only if you want to. I want to keep it relatively straight forward, and limited to JS this week, since this is stuff you'll need to know for your exam.
Here is a version of the page executed with various different options applied so you can check your calculations:
Example: Medium pizza with sausage, and they have agreed to join the mailing list.
Example: Large pizza, all three toppings, agree to be added to the mailing list.
Upload all documents to the server, and include the URL to your page.
Also upload a zip file of all of the documents to the D2L Submissions folder.