Private Sub cmdBook_Click() 'Set up variables Dim NumberOfNights As Integer Dim ArrivalDate As String Dim FamilyName As String Dim FinalCost As Integer Dim SingleRoom As String Dim DoubleRoom As String Dim FamilySuite As String Dim SingleRoomCost As Integer Dim DoubleRoomCost As Integer Dim FamilySuiteCost As Integer Dim NumSingleRoom As Integer Dim NumDoubleRoom As Integer Dim NumFamilySuite As Integer Dim NumRooms As Integer Dim OverAllCost As Integer 'Clears lists lstRoomsBooked.Clear lstCostOfRoom.Clear 'Gets family name and arrival date from user and assigns them to set variables FamilyName = InputBox("Please enter your family name.") ArrivalDate = InputBox("Please enter your desired arrival date using the DD/MM/YY format.") 'Do loop to get the number of nights user wishs to stay. Makes user choose a value from 1 to 14 Do NumberOfNights = InputBox("Please enter the number of nights you wish to stay. You can stay from 1 to 14 nights.") Loop Until NumberOfNights > 0 And NumberOfNights < 15 'Displays the Family Name, Arrival Date and Number of Nights to the interface txtFamilyName.Text = FamilyName txtArrivalDate.Text = ArrivalDate txtNumberOfNights.Text = NumberOfNights 'Do loop to get the type of rooms the user wishes to use, forces user to rent from 1 to 4 rooms. Do MsgBox "You may rent up to 4 rooms. " NumSingleRoom = InputBox("Please enter the number of SINGLE rooms you wish to use.") NumDoubleRoom = InputBox("Please enter the number of DOUBLE rooms you wish to use.") NumFamilySuite = InputBox("Please enter the number of FAMILY SUITE rooms you wish to use.") NumRooms = NumSingleRoom + NumDoubleRoom + NumFamilySuite Loop Until NumRooms > 0 And NumRooms < 5 'Defines the cost of a Single Room, Double Room and Family Suite SingleRoomCost = 47 DoubleRoomCost = 90 FamilySuiteCost = 250 'Adds the number of single rooms to the 'RoomsBooked' list, only if there is a single room booked. If NumSingleRoom > 0 Then SingleRoom = NumSingleRoom & " Single Room" lstRoomsBooked.AddItem (SingleRoom) lstCostOfRoom.AddItem (SingleRoomCost) Else SingleRoom = " " End If 'Adds the number of double rooms to the 'RoomsBooked' list, only if there is a double room booked. If NumDoubleRoom > 0 Then DoubleRoom = NumDoubleRoom & " Double Room" lstRoomsBooked.AddItem (DoubleRoom) lstCostOfRoom.AddItem (DoubleRoomCost) Else DoubleRoom = " " End If 'Adds the number of family suites to the 'RoomsBooked' list, only if there is a family suite booked. If NumFamilySuite > 0 Then FamilySuite = NumFamilySuite & " Family Suite" lstRoomsBooked.AddItem (FamilySuite) lstCostOfRoom.AddItem (FamilySuiteCost) Else FamilySuite = " " End If 'Sum to find the final cost (not overall cost) FinalCost = ((SingleRoomCost * NumSingleRoom) + (DoubleRoomCost * NumDoubleRoom) + (FamilySuiteCost * NumFamilySuite)) * NumberOfNights 'Checks if 10% discount is available under the cirumstances, if yes, sum to take 10% then adds 20% VAT, if no, sum to add 20% VAT only. Then displays overall cost to textbox. If NumRooms > 2 Or NumberOfNights > 6 Then OverAllCost = FinalCost * 0.9 OverAllCost = OverAllCost * 1.2 txtFinalCost.Text = "£" & OverAllCost Else OverAllCost = FinalCost * 1.2 txtFinalCost.Text = "£" & OverAllCost End If End Sub