Description
A travel agency called Maui Vacations Inc. specializes in facilitating booking for vacationers going to Maui, Hawaii. The table below shows the typical vacation items that an individual can book through Maui Vacations Inc.
Vacation Item | Cost |
Flight (round trip) | $350 |
Hotel stay (base rate) | $225/day |
Car (regular) | $25/day |
The daily base rate for a standard queen-bed garden view room at a beach-front hotel is $225/day. Additionally, guests can upgrade to a different room type (either ocean view or oceanfront) for additional cost as indicated in the table below on the next page.
Hotel Room Type | Daily Rate |
Garden View | Base rate |
Ocean View | Base rate +$25 |
Oceanfront | Base rate +$50 |
Moreover, Maui Vacations Inc. offers its customers some discount if they bundle vacation items. Right now, Maui Vacations Inc. is offering discounts for bundled booking of flight, hotel stay, and car rental. The discount rates are indicated in the table below.
Number of Bundled Items | Discount |
2 items (flight + hotel or flight + car or hotel +car) | 10% |
3 items (flight + hotel +car) | 15% |
Furthermore, vacationers can also book for certain popular activities through Maui Vacations Inc. Currently, they have a promotion for the activities in the table below from which an individual can choose whichever activity(ties) he/she is interested in participating in during his/her vacation in Maui. To book a vacation through Maui Vacations Inc., a customer must select at least one activity.
Activity | Cost |
Old Lahaina Luau | $116 |
Hana Adventure Tour | $130 |
Molokini Picnic Snorkel | $144 |
Haleakala Sunrise Excursion | $136 |
Atlantis Submarine | $123 |
What you should do
You are provided with an HTML template file along with a cascading styles sheet (css) file for you to use to complete your work.
Data validation
. Create JavaScript confirmSubmit() function that has components to check if the customer has entered customer information, filled in the duration of stay, and made appropriate selections for other components under booking details.
. Note that if a customer makes a choice from individual items, she/she should not at the same time make a choice from bundled items (i.e., they are mutually exclusive). Create functions that ensure that a customer cannot choose from both option groups simultaneously (i.e., at the same time).
. For duration of stay, create a function that checks if the value entered is a number.
. Note that functions you created for parts b) and c) are not included in the confirmSubmit() function.
Performing calculations
Once you have completed data validation, perform calculations using user entries/selections under booking details and the data provided in the tables above. Cost items listed on a per day basis have to be multiplied by duration of stay to obtain appropriate cost.
3. Displaying Booking Information
In the right-hand-side of the HTML template provided, you should display booking information for the customer. Your responses should replace the placeholders I have put in there.
. Start by inserting a function that displays current date in the following format: day of the week, moth, day, year (e.g., Wednesday, October 14, 2015). Use date functions and arrays to accomplish this task.
. You should also display a customized greeting based on the time of the day that identifies the customer by name. The customized greeting should have the following options, based on time of the day: Good morning, Good afternoon, and Good evening. Use date functions to display customized greeting; and then pass customer name from the name textbox to provide personalized greeting.
. Under Booking Summary, display the inputs/selections the customer made under Booking Details part of the form, along with associated costs and total cost. For individual and bundled items, recall that the customer cannot select from those option groups at the same time. Depending on whichever of those options a customer selects, display “None” for the other option (for example, if a customer selects from individual items group, then bundled items selected would be “none”, and the cost associated with bundled items would be zero).
How the script should work
Once a user clicks on “Preview Booking”, data validation that is part of the confirmSubmit() should be performed (i.e., other data validation that is not part of the confirmSubmit() function is done prior to that) and if everything is fine, then computations are carried out and booking information is displayed for the customer. Make sure that you include an onSubmit event in the opening tag of the form that calls the confirmSubmit() function. Other functions should be called within your HTML as appropriate.