Question
Airline Seat Selection Please write out what name you go with for the labels for example confirmseatButton/exitButton and for the radiobuttons please! Thanks Instructions In
Airline Seat Selection
Please write out what name you go with for the labels for example confirmseatButton/exitButton and for the radiobuttons please! Thanks
Instructions
In this case, you will create a Visual Basic solution that allows the Island Breezes Sea Planes airline to assign seats to passengers. This program demonstrates the use of parallel one-dimensional arrays. One array is used to represent the availability of each seat. The other array is used to manage the RadioButton controls on the form. It introduces the technique of using an array of RadioButton objects. Here are instructions on how to design and code this project:
Step 1: Create the Project:
Create a Visual Basic Project using the project name AirplaneSeating.
Step 2 Design the Form:
Design the form as shown in Figure 1. You will need two button controls, one textbox, one group box, eight radio buttons, one picture box, and two label controls.
Step 3 Declare the form-level arrays:
Declare an array of Boolean values to indicate the availability of each seat:
Private availableSeats(7) As Boolean
Declare an object array as type RadioButton:
Private buttons(7) As RadioButton
Step 3 Add code in the Forms Load event to initialize the arrays:
Each object in the buttons array must be initialized to be a RadioButton object. In the Forms Load event, write a loop to initialize each array element using this syntax:
buttons(i) = New RadioButton
After this loop, load each individual radio button into an array position, using this syntax (in this example, the first
radio button controls name is seat10ARadioButton, and it is being loaded into the first object array position):
buttons(0) = seat10ARadioButton
Do this for each radio button control.
Finally, write a loop to set the Checked property of all of the buttons array elements to False.
Step 4 Create a sub procedure for showing seat availability on the form:
Create a sub procedure named UpdateSeatButtons that will loop through the availableSeats array. If an element in the availableSeats array equals False, set the corresponding buttons array elements Enabled property to False to visually indicate that this seat is no longer available.
Step 5 Create a function for determining if there are any seats still available:
Create a Boolean function named CheckForAvailable that will loop through the availableSeats array to determine if there are any seats still available. If there is at least one seat available, return a True value; otherwise, return False.
Step 6 Add code in the Confirm Seat buttons Click event to update the seating chart:
Loop through the buttons array to determine which button was selected. Set the corresponding availableSeats array element to False. Then call the UpdateSeatButtons sub procedure to update the visual seating chart.
Call the CheckForAvailable function to determine whether you should display a message indicating that the flight is full.
Step 7 Finish up:
Be sure to add the code for the Exit button.
Step 8: Save and run
Save all files, then start the application. Test the program using various selections. Figure 2 shows a sample run of this program, with the users choices shown. Notice that the unavailable seats are grayed.
Figure 2
Image for Dolphin
seat selection Island Breezes Sea Planes Passenger Name: Seat Selection 10A 10-B 11AC 11-B 12AC 12B 13A 13-B Confim Seat E xitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started