In this assignment, students will demonstrate the abilities to:
- Create multi-form Windows applications
- Use various GUI controls
- Create event handlers
- Learn testing and debugging programs
Description
Create a Windows Form application for hotel room reservation. In this application, the customer enters information such as check-in date, length of stay, number of guests, room type, contact information and billing information.
There are four forms in this application. In the first form, the customer uses a DateTimePicker to choose a check-in date, and two NumericUpDown controls to choose length of stay and number of guests:
Check-in date: The default check-in data is today. The customer cannot choose a date in the past or more than 365 days in advance.
Number of nights: The default is 1 night. It cannot be negative or greater than 60.
Number of guests: The default is 1 guest. It cannot be negative or greater than 6.
The customer clicks the Next button to go to the next form.
In the second form, the customer chooses a room type:
Three types of rooms are available:
1 queen size bed: $139 per night plus tax. Maximum capacity is 2 persons.
2 queen size bed: $169 per night plus tax. Maximum capacity is 4 persons.
Suite: $209 per night plus tax. Maximum capacity is 6 persons.
The customer clicks a RadioButton to choose a room type. The program needs to check whether number of guests exceeds the capacity of the room. If it does, show an error in a MessageBox and deselect the room type chosen by the customer. For example, suppose there are 5 guests but a room with 1 queen size bed is chosen, show the following error and deselect customer’s choice:
The customer clicks the Next button to go to the next form. Check to see whether the customer has chosen a room type. It no room type is chosen, stay in the same form and show an error message:
The customer enters contact and billing information in the next form:
Name, phone number, street address, city, state, zip code and card number are entered into TextBoxes. The customer also uses a ComboBox to choose credit card type: American Express, Master or Visa. American Express is the default.
The customer clicks the Next button to go to the next form. Check to see whether information is entered in every Textbox. If something is missing, use a MessageBox to show what is missing. For example, if phone number is not entered, display the following error message:
Do not go to the next form until every Textbox in the form is filled.
In the next and last form, a summary of the reservation is displayed, including check-in date, check-out date, length of stay, number of guests, daily rate, subtotal, tax, total, name, phone number, full address and credit card number.
Subtotal is the room charge before tax. For example, if daily rate is $209 and the room is reserved for 2 nights, the subtotal will be $418.
Tax is 10% of the subtotal. Total is the sum of subtotal and tax.
The following is an example:
All together there are four forms in this application. The customer will see only one form at a time. You can use the Show and Hide methods of a form to control whether a form is visible or not.
Hint: You may want to write a class to store all data about the reservation. Create an instance of this class in the first form. Pass this object along as an argument whenever we go from one form to the next. Write a constructor that takes this object as a parameter for each form class except the first form.
Grading rubric
GUI controls:
DateTimePicker [5 pts]
NumericUpDowns [5 pts]
RadioButtons [5 pts]
Buttons [5 pts]
TextBoxes [5 pts]
ComboBox [5 pts]
Labels [5 pts]
Event handling and other processing:
Setting default, minimum and maximum check-in date [5 pts]
Going to room type selection page when “Next” button in first page is clicked [5 pts]
Checking whether number of guests exceeds room capacity [5 pts]
Checking whether a room type is selected when the “Next” button in second page is clicked [5 pts]
Going to customer information entry page if a room type is selected and the “Next” button in second page is clicked [5 pts]
Checking whether all Taxboxes are filled when “Next” button in customer information entry page is clicked [5 pts]
Going to reservation summary page if all Taxboxes in customer information entry page are filled and the “Next” button is clicked [5 pts]