Due Tuesday, May 12th at 11:59 PM Central Time
For this assignment you will simulate a (admittedly very simple) travel agent site.
Create a page containing a form in which you ask the user for some information. You will then output the cost for their trip. Your form should have the following fields:
- Full Name (text box)
- Destination (select box) with options for New York, Los Angeles, Miami, Mexico City
- Nationality (Radio button) with options for USA, Canada, Mexican, Other
- Number of days traveling (text box)
- First class travel (checkbox)
- Travelling with Spouse (Radio button) with options for Yes and No.
The business logic is as follows
- The daily cost for the destination is $200 if they are travelling to Miami or Mexico City, but $300 per day if they are travelling to New York or Los Angeles.
- A passport is required if they are travelling to Mexico City and are not a Mexican citizen.
- If they wish to travel first class, there is a $400 surcharge.
- If they are bringing their spouse, the cost is doubled.
What your function should do
Your code should let the user know the total cost of their trip and whether or not they need to bring a passport. For example, if a Canadian citizen wishes to go to Mexico City for 5 days ($200*5), wishes to travel first class ($400) and is traveling with their spouse, then their total cost is ($1000+$400)*2, to give a total of $2800. Because they are a Canadian citizen, they should also be reminded to travel with their passport. So your form should say something like:
"The estimated cost of your trip is $2800. Please note that you will need to bring your passport."
You must output this statement to a section on your page (e.g. a new 'div' section) using the innerHTML property discussed in one of the lectures.
- Don't forget that when retriving a numeric value from a text box, it comes in as a string and must therefore be converted to a numeric value.
- It would probably be easiest to start off with a variable to hold cost, initialize it to 0, and then update as you investigate the different form elements.
- You may want to have a string (or perhaps 2 or 3 strings), and then concatenate them together in your final statement.
- Submit to the D2L Dropbox by May 12th at 11:59.
- You may submit up to 1 week after the deadline (May 19th) albeit with a small deduction of 1 point per day late.
- If your assignment contains extra files (external CSS, images, etc), please bundle them all together in a zip file and submit that.
- The assignment will be graded out of 50 points.