1. Stores 5 usernames in an array on strings
2. Asks user for their ID then validates it
3. Asks them for their desired seat number
4. Displays booking details and creates the final ID from the first 6 letters of the ID.
Here is what I have done so far, please look and see if you see any errors and improvements as I don't think the program works.:
Option Explicit
Dim ids(4) As String
Dim bookings(4) As String
Dim counter As Integer
Dim passengerid As String
Dim finalID As String
Dim seatnumber As Interger
Dim flightnuber As String
Private Sub create_arrays(ByRef ids(), flightnumber, bookings())
ids(0) = "WallaceW48P01"
ids(1) = "LauderH468P02"
ids(2) = "CarnegieA468P3"
ids(3) = "ScottW468P04"
ids(4) = "DeBruisR468P05"
flightnumber = "HA468"
bookings(1) = ""
bookings(2) = ""
bookings(3) = ""
bookings(4) = ""
End Sub
Private Sub check_id(ByRef ids(), passengerid)
Dim found As Boolean
passengerid=InputBox("Please enter your user ID")
If ids(counter) = passengerid Then
found = True
MsgBox ("The ID you entered was accepted")
Else
MsgBox ("The ID you entered was invalid, please re=enter")
End If
Loop Until found = True
End Sub
Private Sub book_seat(ByRef bookings(), seatnumber, id() ByVal passengerid
Dim found As Boolean
Do
seatnumber=InputBox("Enter the seat number you want between 1 and 5")
Do
If seatnumber<1 Or seatnumber>5 Then
seatnumber=InputBox("The seat you have entered is not between 1 and 5.")
End If
Loop Until seatnumber >1 And seatnumber <5
If bookings(seatnumber)=""Then
found=True
bookings(seatnumber)="Booked"
MsgBox("Your seat has been booked")
Else
MsgBox("Seat is not available, please enter another number")
End If
Loop Until found = True
End Sub
Private Sub display_results(ByVal flightnumber, passengerid, seatnumber)
finalid=Mid$(passengerid, 1, Len(passengerid), 6)
label1.Caption = flightnumber
label2.Caption = passengerid
label3.Caption = finalid
label4.Caption = seatnumber
End Sub

New Topic/Question
Reply




MultiQuote







|