Q1: The first part of the assignment involves creating very
Added on - Sep 2019
Showing pages 1 to 1 of 1 pages
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. CreateaJPanelinside 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 backgroundcolor 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 asthe departure time and the arrival time to search for one or more available flights in an Itinerary. Also, createaComboBoxthat will allow the user to select from a list of flight Itineraries. Each item in theComboBoxrepresents anItinerary 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 aninteger as a departure time instead of a String (ie1200 instead of 12:00 PM), aJOptionPaneerror message should appearstating, "Incorrect format for departure time." If the airline they entered is not in the Airlineenum, then the option paneshould 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 getpopulated.When the user clicks View, if all the fields are filled out and have valid input, aJOptionPanewith a messagedialog should appear stating, "Flight search successful!"The frame should open a newJFramewith the title, "FlightInformation," 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 youimplemented 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 GUImay look slightly different due to the positioning of elements, or the visualscheme of your computer.