logo

Creating a Flight Reservation GUI with Search and View Functionality

1 Pages716 Words228 Views
   

Added on  2019-09-16

About This Document

This tutorial covers creating a Flight Reservation GUI with search and view functionality using Java Swing components. It includes creating a JFrame, JPanel, slider, text fields, error checking, and displaying flight information.

Creating a Flight Reservation GUI with Search and View Functionality

   Added on 2019-09-16

ShareRelated Documents
Q1:The first part of the assignment involves creating very basic GUI controls: a frame, panel, and slider.Create aJFrame. Add a title to the frame called Flight Reservation. Set the frame size to 475 by 500 pixels. Create aJPanelinside of the frame. You will be adding all of your UI components to thisJPanel. [6pts]Inside of the panel, create a label that says "Choose Color." Right below it, make a slider that changes the background color of the panel when the slider is moved to a particular color. The slider values should be RGB color values from 0 to 255(or black to white). Assume that the RGB values for red, green, and blue are the same value - for instance: (240, 240, 240).The slider label's text should be replaced with the RGB value that the slider is currently on.[8pts]Q2:Add functionality to search for an Itinerary.Create labels and text fields that allow the user to enter an airline, a source airport, and a destination airport, as well as the departure time and the arrival time to search for one or more available flights in an Itinerary. Also, create aComboBoxthat will allow the user to select from a list of flight Itineraries. Each item in theComboBoxrepresents an Itinerary element, e.g. the firstcomboBoxelement is the first Itinerary in the array.[15pts]Make sure all text fields have error checking and exception handling for invalid input. For example, if the user enters an integer as a departure time instead of a String (ie1200 instead of 12:00 PM), aJOptionPaneerror message should appear stating, "Incorrect format for departure time." If the airline they entered is not in the Airlineenum, then the option pane should say, "Airline unavailable. Please choose a different airline." If the airport they entered is not in the Airportenum, then the option pane should say, "Unknown city." Make sure the times are inhh:mm format. [8pts]Q3:Create a button that says Search and a button that says View. When the user clicks Search, thecomboboxwill get populated.When the user clicks View, if all the fields are filled out and have valid input, aJOptionPanewith a message dialog should appear stating, "Flight search successful!"The frame should open a newJFramewith the title, "Flight Information," and a size of 475 by 500 pixels. This frame has the flight information displayed in aJTextArea. [6pts]Q4:On the Flight Information frame, you will need to displayinformation for each Flight in the Itinerary [7 points]:Airline: Display the airlineModel: The model of the airplane should be generated from the Plane object inside of the Flight class.DepartureAirport: Display the source airportDeparture City: Display the departure city based on thedeparture airport(use thegetAirportCity() method you implemented in the Unit 3 assignment to get the airport city)Destination Airport: Display the destinationairportDestination City: Display the destination city based on thedestination airport(use thegetAirportCity() method again)Departure Time: Display the departure timeArrival Time: Display the arrival timeFlight Number: A flight number should be selected based on the airline, followed by the Flight's number.Cost: Display the total cost, which should be computed by the Itinerary object.When you run your code, your UI should look similar to the output below. Your GUI may look slightly different due to the positioning of elements, or the visual scheme of your computer.
Creating a Flight Reservation GUI with Search and View Functionality_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Flight Reservation Form
|2
|562
|357