Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Upload the code In this assignment, you'll add code that calculates the number of nights, total price, and average price for a reservation based on

Upload the code
In this assignment, you'll add code that calculates the number of nights, total price, and average price for
a reservation based on the arrival and departure dates the user enters.
Open the project and implement the calculations
Open the Reservations project attached here with this assignment and review the code for
the form. Notice that it contains event handlers for the click events of the Calculate and
Exit buttons, plus several data validation methods.
Modify the Click event handler for the Calculate button so it gets the arrival and
departure dates the user enters. Then, calculate the number of days between those dates,
calculate the total price based on a price per night of $120, calculate the average price per
night, and display the results.
Test the app to be sure it works correctly. At this point, the average price will be the same
as the nightly price.
Enhance the way the form works
Add an event handler for the Load event of the form. This event handler should get the
current date and three days after the current date and assign these dates to the Arrival
Date and Departure Date text boxes as default values. Be sure to format the dates as
shown above. 5. Modify the Click event handler for the Calculate button so Friday and Saturday nights are
charged at $150 and other nights are charged at $120. One way to do this is to use a while
loop that checks the day for each date of the reservation.
6. Test the app to be sure that the default dates are displayed correctly and that the totals are
calculated correctly.
Add code to validate the dates
7. Add code to the IsDateTime() method that checks that a value is a valid date.
8. Add code to the IsWithinDateRange() method that checks that a value is within a date
range that includes the minimum and maximum dates that are passed to it.
9. Add code to the IsLaterDate() method that compares the two values passed to it and
makes sure the second value is later than the first value.
10. Add code to the IsValidData() method that uses the IsDateTime(), IsWithinDateRange(),
and IsLaterDate() methods to validate the arrival and departure dates. These dates should
be in a range from the current date to five years after the current date, and the departure
date should be later than the arrival date.
11. Modify the Click event handler for the Calculate button so it uses the IsValidData()
method to validate the arrival and departure dates.
12. Test the app to be sure the dates are validated properly.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago