OBJECTIVE:
The objective of the assignment is to use object-oriented design techniques to design an application.
DESCRIPTION:
A small airline has just purchased a computer for its new automated reservations system. You have been hired to design an airline seating application for the FBN (Fly-By-Night) Airlines. In this portion of the assignment, the task is to do the object oriented design for the application. This system will be used only by the company and its employees. Customers will not interact with the system.
Your application should, of course never assign a seat that has already been assigned. When the first class section is full you should ask the user if s(he) would like the economy section and when the economy section is full you should ask the user if s(he) would like the first class section.
REQUIREMENTS:
Design an application that assigns seats on an airplane. The airplane has 20 seats in first class (five rows of 4 seats each, separated by an aisle) and 90 seats in economy class ( 15 rows of 6 seats each, separated by an aisle). Your app should take four commands: add passengers, show seating, create ticket and quit. When passengers are added, ask for the passenger's name, the class (first or economy), the number of passengers traveling together ( 1 to 2 in first class, 1 to 3 in economy), and the seating preferences (aisle or window in first class, center or window in economy). Try to find a match and assign seats. Then create tickets for the passenger. The passenger tickets should be stored in an output file so they can be retrieved and printed at the airport. If no match exists, display a message. Follow the design process that is described in the presentation for this topic.
Once you have a conceptual model for your application, you should identify the classes you will need to implement your model. Once the classes have been identified you need to identify their responsibilities and relationships to the other classes
1. A UML class diagram showing all your classes and the relationships between them.
2. A sequence diagram of one particular interaction between objects in your application. Label the diagram with the name of the scenario you are modeling.
import java.util.Scanner;
public class Airline
{
boolean[] seating = new boolean[111]; /* create 110 seat numbers (array[0] will not be used). Empty seat indicated by false*/
Scanner input = new Scanner(System.in);
public void start()
{
while ( true )
{
makeReservation();
}
}
public void makeReservation()
{
System.out.println("Please type 1 for First Class or 2 for Economy: ");
int section = input.nextInt();
if ( section == 1 )
{
firstClassSeat();
}
else
{
economySeat();
}
}
public void firstClassSeat() // assign a first class seat
{
for ( int count = 1; count <= 20; count++ )
{
if ( seating[count] == false ) // if false, then a seat is available for assignment
{
seating[count] = true; // assign seat
System.out.printf("First Class. Seat# %d\n", count);
break;
}
else if ( seating[5] == true ) // If seating[5] is true then first class is fully booked
{
if ( seating[110] == true) // If seating[10] is true then economy (and therefore whole flight) is fully booked
{
System.out.println("Sorry, flight fully booked. Next flight is in 3 hours.");
}
else // ask passenger if they would like an economy ticket instead
{
System.out.println("First Class is fully booked. Would you like Economy? 1 for Yes 2 for No");
int choice = input.nextInt();
if ( choice == 1 )
{
economySeat();
start();
}
else
{
System.out.println("Next flight is in 3 hours.");
System.exit(0);
}
}
}
}
}
public void economySeat() // assign an economy seat
{
for ( int count = 6; count <= 10; count++ )
{
if ( seating[count] == false ) // if false, then a seat is available for assignment
{
seating[count] = true; // assign seat
System.out.printf("Economy. Seat# %d\n", count);
break;
}
else if ( seating[10] == true ) // If seating[10] is true then economy is fully booked
{
if ( seating[5] == true) // If seating[5] is true then first class (and therefore whole flight) is fully booked
{
System.out.println("Sorry, flight fully booked. Next flight is in 3 hours.");
System.exit(0);
}
else // ask if passenger would like a first class ticket instead
{
System.out.println("Economy is fully booked. Would you like First Class? 1 for Yes 2 for No");
int choice = input.nextInt();
if ( choice == 1 )
{
firstClassSeat();
start();
}
else
{
System.out.println("Next flight is in 3 hours");
System.exit(0);
}
}
}
}
}
}
Launcher.java
public class Launcher {
public static void main(String[] args) {
// TODO Auto-generated method
stub
Application app = new
Application();
app.start();
}
}
Application.java
import java.io.*;
import java.util.*;
import javax.swing.JOptionPane;
public class Application {
boolean[][] airplane = new boolean [4][5];//make a 2D
array for the booking
String[][] airplaneLable = new String [4][5];//make a
2D array for the labeling the seats
String[][] passengerList = new String [4][5];
String[][] passengerInfoList = new String
[0][2];
public void start() {
readingFiles();
booking();
}
private void readingFiles() {
try
{
String [][]
tempAirplane = readCSVFile("airplane.csv");
for(int
i=0;i<tempAirplane.length;i++)
{
for(int
j=0;j<tempAirplane[i].length;j++)
{
airplane[i][j] =
Boolean.parseBoolean(tempAirplane[i][j]);
}
}
passengerList =
readCSVFile("passengerlist.csv");
if(passengerList.length==0)//When there is no file named
passengerlist.csv, the passengerList array's length set to 0.
{
String[][] blankPassengerList = new String
[4][5];
passengerList = blankPassengerList;
}
}
catch(Exception e)
{
}
}
private String[][] readCSVFile(String fileName){
String[][] data = new
String[0][];//csv data line count=0 initially
try
{
int i = 0;//line
count of csv
String
thisLine;
FileInputStream
fis = new FileInputStream(fileName);
DataInputStream
myInput = new DataInputStream(fis);
while ((thisLine
= myInput.readLine()) != null)
{
++i;//increment the line count when new line
found
String[][] newdata = new String[i][2];//create
new array for data
String strar[] = thisLine.split(",");//get
contents of line as an array
newdata[i - 1] = strar;//add new line to the
array
System.arraycopy(data, 0, newdata, 0, i -
1);//copy previously read values to new array
data = newdata;//set new array as csv data
}
for(int j = 0; j
< data.length;j++)
{
for(int k = 0; k < data[j].length;k++)
{
if(data[j][k].equals("null"))
data[j][k]
= null;
}
}
}
catch(Exception e)
{
}
return data;
}
private void booking() {//method for booking
airplaneLable = namingTable();//get
the labels for the table
while (true)
{
String
htmlString = makingTable();//make the table from the array
int reaction =
displayTable(htmlString);//show the table and ask the user if s/he
wants to book a seat
if
(reaction==0)//User says yes
{
boolean allSeatsBooked =
allSeatsBooked();//check if there are available seats for the
plane
if(allSeatsBooked==true)//if no seats are
available, show sorry message and close the program
{
JOptionPane.showMessageDialog(null, "Sorry, All the Seats Are
Already Booked. Next Flight Leaves in 3 Hours.");
exitProgram();
}
String name = getPassengerName();//get the name
of the user and validate it
int seatClass = getPassengerClass();//get the
class selection
if(noSeatsforClassBooked(seatClass)==true)
//check if there are available seats for the class
{
String[] options = {"Yes",
"No"}; //ask if the user wants to book a seat even if there is no
seats for that class
int fullClassReaction =
JOptionPane.showOptionDialog(null, "There Are No Seats Available
Matching Your Choice. Would You Like a Different Class", "Change
Class?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
null, options, options[0]);
if
(fullClassReaction==0)//Yes -> choose the other class
{
if(seatClass==0)//if the previous selection was 1st class,
seatClass=1;//go to economy class
else//if
not
seatClass=0;//go to 1st class
}
else//if user doesn't want to
book a seat for the other class, say goodbye
{
JOptionPane.showMessageDialog(null, "Sorry, There Are No Seats that
Match Your Requirements. Next Flight Leaves in 3 Hours.");
exitProgram();
}
}
int windowOrAisle = windowOrAisle();//get the
preference about the seats
seatAllocation(seatClass,windowOrAisle,name);//allocate the seat
based on the information
}
else//if the
user doesn't want to book a seat, end the program
exitProgram();
}
}
private String[][] namingTable(){//labeling the table:
the central cells are for the aisle, so made them blank, the other
seats should have rows(A,B,C,D) and columns(1,2,3,4) name
String[][] table = new
String[4][5];
for(int
i=0;i<airplaneLable[0].length/2;i++)
table[0][i] =
"A" + String.valueOf(i + 1);
for(int
i=(table[0].length/2)+1;i<table[0].length;i++)
table[0][i] =
"A" + String.valueOf(i);
for(int
i=0;i<table[1].length/2;i++)
table[1][i] =
"B" + String.valueOf(i + 1);
for(int
i=(table[1].length/2)+1;i<table[1].length;i++)
table[1][i] =
"B" + String.valueOf(i);
for(int
i=0;i<table[2].length/2;i++)
table[2][i] =
"C" + String.valueOf(i + 1);
for(int
i=(table[2].length/2)+1;i<table[2].length;i++)
table[2][i] =
"C" + String.valueOf(i);
for(int
i=0;i<table[3].length/2;i++)
table[3][i] =
"D" + String.valueOf(i + 1);
for(int
i=(table[3].length/2)+1;i<table[3].length;i++)
table[3][i] =
"D" + String.valueOf(i);
return table;
}
private String makingTable() {//making a table: aisle
-> yellow, available seat(false) -> green, and unavailable
seat(true) -> red
String
htmlString="<html><body><table
style=\"font-size:36\">";
for(int i=0;
i<airplane.length;i++)
{
airplane[i][airplaneLable[0].length/2]=true;
htmlString+="<tr>";
for(int j=0;
j<airplane[i].length/2;j++)
{
if(airplane[i][j]==false)
htmlString+="<td
style=\"background-color:green\">" + airplaneLable[i][j] +
"</td>";
else
htmlString+="<td
style=\"background-color:red\">" + airplaneLable[i][j] +
"</td>";
}
htmlString+="<td
style=\"background-color:yellow\"></td>";
for(int
j=(airplane[i].length/2)+1; j<airplane[i].length;j++)
{
if(airplane[i][j]==false)
htmlString+="<td
style=\"background-color:green\">" + airplaneLable[i][j] +
"</td>";
else
htmlString+="<td
style=\"background-color:red\">" + airplaneLable[i][j] +
"</td>";
}
htmlString+="</tr>";
}
return htmlString;
}
private int displayTable(String table) {//when show
the table, ask user if s/he wants to book a seat
Object[] options = {"Book Your
Seat","Quit Program"};
int reaction =
JOptionPane.showOptionDialog(null, table,"Airline Seat Booker",
JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE,null,options,options[0]);
return reaction;
}
private String getPassengerName() {//get the user's
name and validate it
String name;
while(true)
{
name =
JOptionPane.showInputDialog("Please Enter the Passenger's Name:
");//get the name
boolean
ifNameIncludeNumbers=true;//validate if the name includes any
number
String numbers =
"1234567890";
char
testChar;
String testName
= name.toLowerCase();
for(int
i=0;i<name.length();i++)
{
testChar = testName.charAt(i);
if(numbers.indexOf(testChar)<0)
ifNameIncludeNumbers =
false;
else
ifNameIncludeNumbers =
true;
}
if(name.length()==0)//if user didn't input anything
JOptionPane.showMessageDialog(null, "You've
entered nothing. Please try again.");
else
if(ifNameIncludeNumbers)//if user's input contains number
JOptionPane.showMessageDialog(null, "You've
entered name including numeric value. Please try again.");
else
if(name.equals("null"))//if user's input was null
JOptionPane.showMessageDialog(null, "You cannot
input the name 'null'. Please try again.");
else break;//if
the name is valid, go further
}
return name;//and give the name
into the program
}
private int getPassengerClass() {//get the user's
class
String[] options = {"First Class",
"Economy Class"};
int reaction =
JOptionPane.showOptionDialog(null, "Please Select Your Preferred
Class: ", "Class Selection", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
return reaction;
}
private int windowOrAisle() {//get the user's
preference
String[] options = {"Window Seat",
"Aisle Seat"};
int reaction =
JOptionPane.showOptionDialog(null, "Please Select Your Seat Type:
", "Seat Type Selection", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
return reaction;
}
private void seatAllocation(int seatClass, int
windowOrAisle, String name) {//allocate the seat
if(seatClass==0)//1st class
{
if(windowOrAisle==0)//window
{
if (airplane[0][0]==false)//check A1
{
airplane[0][0] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: A1");
passengerList[0][0] =
name;
}
else if (airplane[0][4]==false)//check A4
{
airplane[0][4] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: A4");
passengerList[0][4] =
name;
}
else if (airplane[1][0]==false)//check B1
{
airplane[1][0] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: B1");
passengerList[1][0] =
name;
}
else if (airplane[1][4]==false)//check B4
{
airplane[1][4] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: B4");
passengerList[1][4] =
name;
}
else//when there are no available seats for 1st
class and window seats
noAvailableSeats(seatClass,windowOrAisle,name);
}
else//1st class,
aisle seat
{
if (airplane[0][1]==false)//check A2
{
airplane[0][1] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: A2");
passengerList[0][1] =
name;
}
else if (airplane[0][3]==false)//check A3
{
airplane[0][3] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: A3");
passengerList[0][3] =
name;
}
else if (airplane[1][1]==false)//check B2
{
airplane[1][1] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: B2");
passengerList[1][1] =
name;
}
else if (airplane[1][3]==false)//check B3
{
airplane[1][3] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: B3");
passengerList[1][3] =
name;
}
else//when there are no available seats for 1st
class and aisle seats
noAvailableSeats(seatClass,windowOrAisle,name);
}
}
else//economy class
{
if(windowOrAisle==0)//window seats
{
if (airplane[2][0]==false)//check C1
{
airplane[2][0] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: C1");
passengerList[2][0] =
name;
}
else if (airplane[2][4]==false)//check C4
{
airplane[2][4] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: C4");
passengerList[2][4] =
name;
}
else if (airplane[3][0]==false)//check D1
{
airplane[3][0] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: D1");
passengerList[3][0] =
name;
}
else if (airplane[3][4]==false)//check D4
{
airplane[3][4] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: D4");
passengerList[3][4] =
name;
}
else//when there are no available seats for
economy class and window seats
noAvailableSeats(seatClass,windowOrAisle,name);
}
else//aisle
seats
{
if (airplane[2][1]==false)//check C2
{
airplane[2][1] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: C2");
passengerList[2][1] =
name;
}
else if (airplane[2][3]==false)//check C3
{
airplane[2][3] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: C3");
passengerList[2][3] =
name;
}
else if (airplane[3][1]==false)//check D2
{
airplane[3][1] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: D2");
passengerList[3][1] =
name;
}
else if (airplane[3][3]==false)//check D3
{
airplane[3][3] = true;
JOptionPane.showMessageDialog(null, "Name: " + name +"\nAssigned
Seat: D3");
passengerList[3][3] =
name;
}
else//when there are no available seats for
economy class and aisle seats
noAvailableSeats(seatClass,windowOrAisle,name);
}
}
}
private void noAvailableSeats(int seatClass, int
windowOrAisle, String name) {//when specific class and seat type
have no available seats
String[] options = {"Yes",
"No"};//check if the user wants to book for another seat type
int reaction =
JOptionPane.showOptionDialog(null, "There Are No Seats Available
Matching Your Choice. Would You Like a Different Seat Type",
"Change Seat Type?", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
if (reaction == 0)//if yes, try to
find another seat for another seat type
{
if
(windowOrAisle==0)//when user tried to book a seat for window
seats
{
windowOrAisle = 1;//try to book a seat for aisle
seats
seatAllocation(seatClass,windowOrAisle,name);
booking();
}
else
{
windowOrAisle = 0;//if not, try to book a seat
for window seats
seatAllocation(seatClass,windowOrAisle,name);
booking();
}
}
else//if user doesn't want to book
a seat for another seat type, say goodbye
{
JOptionPane.showMessageDialog(null, "Sorry, There Are No Seats that
Match Your Requirements. Next Flight Leaves in 3 Hours.");
exitProgram();
}
}
private boolean allSeatsBooked() {//check if there are
seats available to book
boolean
allSeatsBooked=true;//assume there are no seats available
for (int
i=0;i<airplane.length;i++)//if the program finds any available
seat, set the status as false
{
for(int
j=0;j<airplane[0].length;j++)
{
if (airplane[i][j]==false)
allSeatsBooked=false;
}
}
return allSeatsBooked;
}
private boolean noSeatsforClassBooked(int seatClass)
{//check if there are any available seats for the class
boolean
noSeatsforClassBooked=true;//same as checking for the entire
plane
if(seatClass==0)//1st class
{
for(int
j=0;j<airplane[0].length;j++)
{
if (airplane[0][j]==false)//A row
noSeatsforClassBooked=false;
if (airplane[1][j]==false)//B row
noSeatsforClassBooked=false;
}
}
else//economy class
{
for(int
j=0;j<airplane[0].length;j++)
{
if (airplane[2][j]==false)//C row
noSeatsforClassBooked=false;
if (airplane[3][j]==false)//D row
noSeatsforClassBooked=false;
}
}
return noSeatsforClassBooked;
}
private void exitProgram() {
try {
saveArray(airplane,"airplane");
saveArray(passengerList,"passengerlist");
} catch (IOException e) {
// TODO
Auto-generated catch block
JOptionPane.showMessageDialog(null, "Error occured");
}
String[] Options =
{"Yes","No"};
int reportOrNot =
JOptionPane.showOptionDialog(null, "Would you like to get the
passengers' information?", "Want Report?",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
Options, Options[0]);
if(reportOrNot == 0)
getReport();
System.exit(0);
}
private void saveArray(String[][] array,String
arrayName) throws IOException {
BufferedWriter br = new
BufferedWriter(new FileWriter(arrayName + ".csv"));
StringBuilder sb = new
StringBuilder();
for (int
i=0;i<array.length;i++)
{
for (String
element : array[i]) {
sb.append(element);
sb.append(",");
}
sb.append("\n");
}
String textSB =
sb.toString();
br.write(textSB);
br.close();
}
private void saveArray(boolean[][] array,String
arrayName) throws IOException {
BufferedWriter br = new
BufferedWriter(new FileWriter(arrayName + ".csv"));
StringBuilder sb = new
StringBuilder();
for (int
i=0;i<array.length;i++)
{
for (boolean
element : array[i]) {
sb.append(element);
sb.append(",");
}
sb.append("\n");
}
String textSB =
sb.toString();
br.write(textSB);
br.close();
}
private void makepassengerInfoList()
{
for (int i = 0; i <
passengerList.length;i++)
{
for (int j = 0;
j < passengerList[i].length;j++)
{
try
{
if
(!passengerList[i][j].equals(null))
{
String[][]
temppassengerInfoList = new String
[passengerInfoList.length+1][2];
System.arraycopy(passengerInfoList,0,temppassengerInfoList,0,passengerInfoList.length);
String[]
passengerAndSeat = new String [2];
passengerAndSeat[0] = passengerList[i][j];
passengerAndSeat[1] = airplaneLable[i][j];
temppassengerInfoList[passengerInfoList.length] =
passengerAndSeat;
passengerInfoList = temppassengerInfoList;
}
}
catch(Exception e)
{
}
}
}
}
private void getReport()
{
makepassengerInfoList();
String[] nameList = new
String[passengerInfoList.length];
for (int i=0;i <
nameList.length;i++)
{
nameList[i] =
passengerInfoList[i][0];
}
Arrays.sort(nameList);
String[][] sortedPassengerInfoList
= new String[passengerInfoList.length][2];
for(int i=0;i <
nameList.length;i++)
{
for(int
j=0;j<passengerInfoList.length;j++)
{
if(nameList[i]==passengerInfoList[j][0])
{
sortedPassengerInfoList[i][0]
= nameList[i];
sortedPassengerInfoList[i][1]
= passengerInfoList[j][1];
}
}
}
String report = "The following
passengers will be onboard.";
for (int i = 0; i <
sortedPassengerInfoList.length;i++)
{
report += "\n" +
sortedPassengerInfoList[i][0] + " " +
sortedPassengerInfoList[i][1];
}
JOptionPane.showMessageDialog(null,
report);
}
}
A small airline has just purchased a computer for its new automated reservations system
(Airline Reservations System) A small airline has just purchased a computer for its new automated reservations system. The president has asked you to program the new system. You'll write a program to assign seats on each flight of the airline's only plane (capacity: 10 scats).Your program should display the following menu of alternatives:Please type 1 for "first class"please type 2 for "economy"If the person types 1 , then your program should assign a seat in the first class section (seats...
Programming language C++. (Airline Reservations System) A small airline has just purchased a computer for its new au- tomated reservations system. You have been asked to develop the new system. You’re to write an app to assign seats on each flight of the airline’s only plane (capacity: 10 seats). Display the following alternatives: Please type 1 for First Class and Please type 2 for Economy. If the user types 1, your app should assign a seat in the first-class section...
For this week's assignment , create and complete a Windows application for the following question. Airline Reservation System: An airline has just bought a computer for its new reservation system. Develop a new system to assign seats on the new airplane( capacity: 10 seats) Display the following alternatives: "Please type 1 for first class, and please type 2 for Economy". If the user enters 1, your application should assign a seat in the first class( seats 1-5). If the user...
C# WINDOWS FORMS APPLICATION (not CONSOLE APPLICATION ) (Please screenshot window form of this program and write code on computer. Thank you very much !) For this week's assignment , create and complete a Windows application for the following question. Airline Reservation System: An airline has just bought a computer for its new reservation system. Develop a new system to assign seats on the new airplane( capacity: 10 seats) Display the following alternatives: "Please type 1 for first class, and...
The Course Project can be started in Week 7 and is due by 11:59 pm CT Saturday of Week 8. It must follow standard code formatting and have a comment block at the top of the code file with a detailed description of what the program does. Functions must have a comment block with a detailed description of what it does. Pseudocode must be provided in the comment block at the top of the file. This program will allow the...
In C++. Write a program that can be used to assign seats for a commercial airplane and print out the ticket total. The airplane has 13 rows, with row 7 being the Emergency Exit row. Each row has 7 seats, there are two seats on each side of the plane and three seats in the middle with aisles on both sides. Rows 1 and 2 are considered first class with tickets for this specific flight being $872.00 round trip. Rows 3...
2. An airline is planning their flights between different cities of Turkey. We focus on the flight they will have on August 1st of this year, that departs from Istanbul, stops in Ankara and continues to Antalya. The plan is to sell the tickets to three types of passengers: the ones traveling from Istanbul to Ankara (passenger type 1), the ones traveling from Ankara to Antalya (passenger type 2), and the passengers traveling from Istanbul to Antalya (passenger type 3)....
On a popular air route, an airline offers two classes of service: business class (B) and economy class (E). The respective inverse demands are given by PB = 540 - 0.5QB and PE = 380 - QE. Because of ticketing regulations, business passengers cannot take advantage of economy’s low fares. Each flight has a capacity of 200 passengers, The cost per full flight is $20,000, so you may assume the marginal cost per passenger is $100. Consider the scenario...
I could really use some help with this question! Thanks!! Must use C# and it must be a console application ------------------------------------------------------------------------------------------------------------------------------ You start working on this w/o arrays just with seats: bool f1, f2,..., e1, e2,.... You can use Console application for now. A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You’re to write an app to assign seats on each flight of the airline’s...
Java // Topic 2c // Program reserves airline seats. import java.util.Scanner public class Plane { // checks customers in and assigns them a boarding pass // To the human user, Seats 1 to 2 are for First Class passengers and Seats 3 to 5 are for Economy Class passengers // public void reserveSeats() { int counter = 0; int section = 0; int choice = 0; String eatRest = ""; //to hold junk in input buffer String inName = ""; ...