Question: 1 . Write a Passenger class with private data for passenger name and priority ( 1 , 2 ) with natural ordering from the Comparable
Write a Passenger class with private data for passenger name and priority with natural ordering
from the Comparable interface defined by the priority level.
Fill in the missing code in the App.java program to fill the priority queue with passenger data,
complete the GUI form showing seats, and fill in remaining code as marked by the TODO: comments.
Be sure to test your code on both data sets, passengerstxt and passengerstxt You do not have to
do data validation unless you wish so can assume normal and valid data. Code for InitalApp class: package school.assg;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.geometry.Pos;
import javafx.geometry.Insets;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.paint.Color;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import java.io;
import java.util.PriorityQueue;
import java.util.Scanner;
public class AppInitial extends Application
priority queue of passengers
priority is first class, priority is economy
private PriorityQueue passengers new PriorityQueue;
private Button seats null; D array of buttons that represent the seats
private TextField passengerTextField; displays passenger name
private final int WIDTH ; width of text for button
private int nrows, ncolumns; number of rows and columns
private String blankString; string of WIDTH spaces
@Override
public void startStage stage
Scanner filescan null;
try
filescan new Scanner new Filepassengerstxt;
catch IOException e
System.out.println open error";
System.exit;
nrows filescan.nextInt; number of rows
ncolumns filescan.nextInt; number of columns
filescan.nextLine; extract newline
fonts for the buttons and top label
Font fontlabel Font.fontMonospaced FontWeight.EXTRABOLD, ;
Font fontbutton Font.fontMonospaced FontWeight.EXTRABOLD, ;
seats new Button nrowsncolumns; make the D array of buttons
blankString repeatWIDTH; string of blanks
make the buttons
for int r; r processPassenger; ;
passengerTextField new TextField;
passengerTextField.setEditablefalse;
exit button
Button exitButton new Button Exit;
exitButton.setOnActionevent System.exit; ;
add content to left pane
leftPane.getChildrenaddprocessButton;
leftPane.getChildrenaddpassengerTextField;
leftPane.getChildrenaddexitButton;
leftPane.setAlignmentPosTOPCENTER;
leftPane.setPaddingnew Insets;
add the left pane to the outer pane
outerpane.setLeftleftPane;
center pane is a GridPane
GridPane centerPane new Gri
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
