Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this in C# Windows Forms App In this exercise, you will create a form that calculates the number of nights, total

I need help with this in C# Windows Forms App In this exercise, you will create a form that calculates the number of nights, total price, and average price for a reservation based on the arrival and departure dates the user enters.

1. Start a new project named Reservations.

2. Add labels, text boxes, and buttons to the default form and set the properties of the form and its controls so they appear as shown above. Controls are to have meaningful names.

3. When the user presses the Enter key, the Click event of the Calculate button fire. When the user presses the Esc key, the Click event of the Exit button fire.

4. Rename the form to frmReservations. When ask to modify any references to the form, click the Yes button.

5. Add code to get the arrival and departure dates the user enters when the user clicks the Calculate button. Then, calculate the number of days between those dates, calculate the total price based on a price per night of $150, calculate the average price per night, and display the results.

6. Declare class variables for a row counter and a rectangular array of strings that provides for 10 rows and 3 columns.

7. Add code that stores the values for each calculation in the next row of the array when the user clicks the Calculate button. Store the total price and average price per night in currency format.

8. Add code to display the elements in the array in a message box when the user clicks the Exit button. Use spaces and tab characters to format the message.

9. Test the application to be sure it works correctly. At this point, the average price will be the same as the nightly price.

10. Add an event handler for the Load event of the form. This event handler should get the current date and five 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.

11. Modify code so Friday and Saturday nights are charge at $250 and other nights are charge at $150. One way to do this is to use a while loop that checks the day for each date of the reservation.

12. Test the application to be sure that the default dates are displayed correctly and that the totals are calculated correctly.

13. Code a method named IsDateTime and then add code to check that the arrival and departure dates are valid dates.

14. Code a method named IsWithinRange and then add code to check that the arrival and departure dates are within a range that includes the minimum and maximum dates that are passed to it.

15. Code a method named IsValidData and then add code that uses the IsPresent, IsDateTime, and IsWithinRange 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.

16. Add code that uses the IsValidData method to validate the arrival and departure dates. In addition, add code to check that the departure date is after the arrival date.

17. Test the application to be sure the dates are validated properly.

18. Create an event handler that clears the number of nights, total price, and avg. price per night text boxes if the user changes the value in the arrival date and departure date text boxes.

Thank you so much.

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

What type of processing do Relational Databases support?

Answered: 1 week ago