COMP 503 Auckland institute of studies Airline Reservation System Java Application For this assignment, you will individually develop an Airline Reservatio

COMP 503 Auckland institute of studies Airline Reservation System Java Application For this assignment, you will individually develop an Airline Reservation Application in Java, enabling airlines to view the seating map of a flight and to make seat bookings in first or economy class, based on their policies. COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
The Airline Reservation System
Due date: Monday, 15th June 2020 at 5:00 pm
This assignment has 100 marks and is worth 20% of your final grade.
Brief
For this assignment, you will individually develop an Airline Reservation
Application in Java, enabling airlines to view the seating map of a flight and to
make seat bookings in first or economy class, based on their policies. For a
given flight, the Airline Reservation Application retrieves its seating map
partitioned into first and economy classes, as depicted in the left-hand side of
Figure 1. A seat request marks a seat as booked. For example, the first-class
seat 3E is booked and shown on the left-hand side of Figure 1 as a solid circle.
This Seat is an aisle type of Seat since it is next to an aisle. Similarly, window
type seats are next to the airplane’s windows (such as 5A), and all other seats
are middle type seats (such as 9D).
Figure 1: Seat map stored as a 2D array of Seat objects
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
Methodology and Marking Scheme
You will develop several classes in Java that implement the Airline Reservation
Application. For full marks, your classes must adhere to correct OOP design
principles. You have been provided with an outline of eleven classes which
contain the core functionalities of the Airline Reservation applications:
SeatType, SeatPosition, Seat, SeatMap, AirBusSeatMap, BoeingSeatMap,
Flight, Airline, SimpleWay, SmartLine, and AirlineReservationApplication. The
relationships between classes are described below using a UML Class Diagram
(Figure 2). Complete the assignment by using the given UML class diagram and
following the below steps to develop the eleven classes with the provided
instance variables and methods with appropriate access modifiers (as shown in
the diagram). Take the time to test your methods as you progress.
Note: You need to provide attributes and methods that are listed in the UML
diagram, even those which are not defined in the step sections. Some of them
are clear, and that is why they have not mentioned in steps. You may also add
more methods if you need.
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
SeatMap
SeatType
Seat
WINDOW
AISLE
MIDDLE
# seats: Seat[][]
# nRows: int
# nColumns: int
# nFirstClassRows: int
# initialiseSeatMap()
+ lastSeatColumn(): char
+ lastSeatRow(): int
+ getLeft(Seat): Seat
+ getRight(Seat): Seat
+ toString(): String
+ queryAvailableEconomySeat(SeatType): Seat
+ queryAvailableFirstClassSeat(SeatType): Seat
+ getSeat(int, char): Seat
+ getSeatsArray(): Seat[][]
+ getNRows(): int
+ getNColumns(): int
+ getNFirstClassRows(): int
– seatType: SeatType
– firstClass: boolean
– reserved: boolean
– seatPosition: SeatPosition
+ Seat(SeatPosition, SeatType, boolean)
+ getSeatType(): SeatType
+ isFirstClass(): boolean
+ isReserved(): boolean
+ setReserved(boolean)
+ getSeatposition(): SeatPosition
+ toDescription(): String
+ toString(): String
SeatPosition
– row: int
– column: char
+ SeatPosition(int, char)
+ getRow(): int
+ getColumn(): char
Flight
– flightIdentifier: String
– originCity: String
– destCity: String
– departureTime: String
– seating: SeatMap
+ Flight(String, String, String, String, SeatMap)
+ getFlightNumber(): String
+ getOriginCity(): String
+ setOriginCity(String)
+ getDestCity(): String
+ setDestCity(String)
+ getSeating(): SeatMap
+ setSeating(SeatMap)
+ getTime(): String
+ setTime(String)
+ toString(): String
BoeingSeatMap
AirBusSeatMap
+ BoeingSeatMap()
# initialiseSeatMap()
+ AirBusSeatMap()
# initialiseSeatMap()
AirlineReservationApplication
– flights: ArrayList
– airlines: ArrayList
– keyboard: Scanner
*** Your own attributes if you need ***
+ setup()
+ update()
+ main(String[])
*** Your own methods (if you need) to
interact with the core functionality of
Airline Reservation Application!***
Airline
– airlineName: String
+ Airline(String)
+ reserveFirstClass(Flight, SeatType): Seat
+ reserveEconomy(Flight, SeatType): Seat
+ getAirlineName(): String
+ setAirlineName(String)
+ toString(): String
SimpleWay
SmartLine
+ SimpleWay(String)
+ reserveFirstClass(Flight, SeatType): Seat
+ reserveEconomy(Flight, SeatType): Seat
+ SmartLine(String)
+ reserveFirstClass(Flight, SeatType): Seat
+ reserveEconomy(Flight, SeatType): Seat
Figure 2: UML Diagram of The Airline Reservation Application
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
Storing Seat Maps and Reservations
In this section, you will develop classes to store seat reservations.
Step 1: SeatPosition class
Design a SeatPosition class which contains the row and column of a seat in the
seat map. E.g. 1A, 6C, 2G.
Step 2: Seat class
Design a Seat class which:
• has data (i.e., two attributes) to store whether a seat is reserved or is in
first class.
• has data that stores the type of the Seat: AISLE, MIDDLE, WINDOW
(Hint: consider using an enumerated type. E.g., SeatType enum in a
separate file!).
• stores a SeatPosition object to form a seat map position.
• has toString() method to return a Seat representation according to
the right-hand side of Figure 1. For example,
o if the Seat is in window side of the first-class position and is not
reserved, we can show the Seat like [W _ ]; (Note: The letter for
Seat should be capitalized if the Seat is in the first-class position)
o if the Seat is in window side of economy class position and is
booked, we can show the Seat like [w X ]; (Note: The letter for
Seat should be lowercased if the Seat is in economy class
position)
• Write another method called getSeatDescription() that outputs a
longer text description of the Seat. For example:
The economy class MIDDLE seat at 9D is not reserved.
Step 3: An abstract SeatMap class
Develop an abstract SeatMap class which:
• has an abstract method with the declaration of
abstract protected void initialiseSeatMap().
• stores a two-dimensional array of Seat objects according to the righthand side of Figure 1, to be initialized by concrete classes (see below).
• contains instance variables that
o store the number of rows and columns that comprise the matrix
o maintains the number of rows situated in first-class seats.
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
All instance variables are protected in the SeatMap class. You should not write
any set methods. Instead, it has the following functionality to query the
SeatMap:
• Provide accessor methods that return the last row (e.g., 10) and last
column (e.g., the character ‘G’) in the seat mapping.
o
o
public char lastSeatColumn()
public int lastSeatRow()
• public Seat getSeat(int seatRow, char seatColumn) returns the
Seat in the specified seat map position (Refer to Figure 1).

public Seat getLeft(Seat aSeat)/ public Seat getRight(Seat aSeat)
(two methods) returns a seat to the left or right of the input Seat. (Hint:
use SeatPosition to find the Seat in the 2D array). If the Seat does not
exist, return null.
• public Seat queryAvailableEconomySeat(SeatType aType) returns a
seat in the economy that has the matching SeatType and is not already
booked. If all these types of seats are booked, return any seat in the
economy. If all seats are booked, return null.
• public Seat queryAvailableFirstClassSeat(SeatType aType) is the
same, but only searches first class.
• public String toString() returns a string containing a text
representation of the SeatMap similar to the right-hand side of Figure 1
(the sample representation is as bellow).
1
2
3
4
5
6
7
8
9
10
11
12
A
[W
[W
[W
[W
[W
[W
[w
[w
[w
[w
[w
[w
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
B
[M
[M
[M
[M
[M
[M
[m
[m
[m
[m
[m
[m
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
C
[A
[A
[A
[A
[A
[A
[a
[a
[a
[a
[a
[a
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
D
[A
[A
[A
[A
[A
[A
[a
[a
[a
[a
[a
[a
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
E
[M
[M
[M
[M
[M
[M
[m
[m
[m
[m
[m
[m
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
F
[A
[A
[A
[A
[A
[A
[a
[a
[a
[a
[a
[a
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
G
[A
[A
[A
[A
[A
[A
[a
[a
[a
[a
[a
[a
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
H
[M
[M
[M
[M
[M
[M
[m
[m
[m
[m
[m
[m
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
I
[W
[W
[W
[W
[W
[W
[w
[w
[w
[w
[w
[w
_
_
_
_
_
_
_
_
_
_
_
_
]
]
]
]
]
]
]
]
]
]
]
]
Step 4: Developing two classes that extend SeatMap class.
• Develop a BoeingSeatMap class (extends SeatMap class) which:
o has a default constructor initialising the number of rows to 10, the
number of columns to 7, and the number of first-class rows to 4.
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
The constructor initialises the seat array accordingly. The
constructor calls the initialiseSeatMap method.
o Write an algorithm in initialiseSeatMap method to populate the
seat array according to Figure 3.
• Develop a AirBusSeatMap class (extends SeatMap class) which:
o has a default constructor initialising the number of rows to 12, the
number of columns to 9, and the number of first-class rows to 6.
The constructor initialises the seat array accordingly. The
constructor calls the initialiseSeatMap method.
o Write an algorithm in initialiseSeatMap to populate the seat array
according to Figure 3.
Note: initialiseSeatMap instantiates each Seat object stored in the seat array
with the appropriate SeatPosition object by translating the array indices to a
SeatPosition.
Figure 3: SeatMap subclasses: BoeingSeatMap and AirBusSeatMap
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
Flights
Design a Flight class to store information relating to a flight. The information
contains the origin and destination cities, departure time, flight number, and
a SeatMap object that stores the seat map. Consider the data you will need to
store to implement the functionality of the Airline Reservation Application.
Booking a Flight Seat
Airlines query a flight’s seating map to determine the availability of seats.
• Create an abstract class Airline which
o contains a descriptive name of the Airline and get/set methods.
o has a toString method that prints out a nice representation of the
object.
o has two abstract methods:
§
§
abstract public Seat reserveFirstClass(Flight aFlight,
SeatType aType)
abstract public Seat reserveEconomy(Flight aFlight, SeatType
aType)
• Airline is extended by two concrete classes SimpleWay and SmartLine,
and each class overrides the abstract methods inherited from Airline
and implements the booking based on the following Airline’s seat
booking policies.
Airline Reservation Policies
Different Airlines have different booking policies if the requested seating is
unavailable on a flight. Consider the policies of the following two Airlines:
SimpleWay
1) Seat Reservation in First Class
a) Find and book a seat in first class that matches the requested seat type
b) If no such first-class seat with the matching type exists, then find and
book any seat in the first-class Seat.
c) If there are no seats available in the first class, then find and reserve a
middle or window seat in economy class, also reserving one of the
neighbouring seats (for extra passenger room).
d) If no seats are matching any of these criteria, then a reservation cannot
be made
2) Seat Reservation in Economy Class
a) Find and reserve a seat in economy class that matches the requested
seat type
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
b) If no such economy class seat with the matching type exists, then find
and reserve Seat in economy class
c) If no seats are matching any of these criteria, then a reservation cannot
be made
SmartLine
1) Seat Reservation in First Class
a) Find and book a seat in first class that matches the requested seat type
b) If no such first-class class seat with the matching type exist, then find
and reserve any seat in first-class.
c) If there are no seats available in first class then find and reserve a middle
seat in economy class, also reserving both the left and right
neighbouring seats (for extra passenger room)
d) If no seats are matching any of these criteria, then a reservation cannot
be made
2) Seat Reservation in Economy Class
a) Find and reserve a seat in economy class that matches the requested
seat type
b) If no such economy class seat with the matching type exists, then find
and reserve any seat in economy class.
c) If no seats are matching any of these criteria, then a reservation cannot
be made
Program Interaction
Develop an application class called AirlineReservationApplication, which
interacts with the core functionality of the Airline Reservation Application. You
may consider writing additional methods to simulate the application. Your
program should involve multiple flight journeys to select from different seating
configurations (BoeingSeatMap and AirBusSeatMap) and demonstrate both
airline seat booking policies. The airlines’ policies should be applicable for all
flights.
The Airline Reservation Application provides menu interactions for
1)
Selecting an airline to apply booking policies
2)
Booking economy or first-class seats for a flight using an airline policy
A text file “flights.txt” is provided to you with this assignment. It contains the
flights’ info with reserved seats in flights shown in the “sample-output.txt” file.
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
In your AirlineReservationApplication class, write a static method which reads
this “flights.txt” file, and has the following signature:
public static void setup() throws NumberFormatException, IOException
This method reads the text file and throws the following exceptions:
1)
IOException, thrown if the file cannot be opened/read
2)
NumberFormatException, thrown if integer parsing fails
This method should run first when the application is started to update the
system and make it ready to function. Using this static method needs to use
three static variables. The variables should be static and out of the setup()
method as they should be available for the other methods as well:

private static ArrayList flights;
o to store multiple flight objects.
• private static ArrayList airlines;
o to store airline objects.
• private static Scanner keyboard = new Scanner(System.in);
o to read user input.
You also need to write a static method called update() to write the updated
flight information into the “flights.txt”:
public static void update() throws IOException
You need to keep the flight data and add it to the existing file. The method
throws the IOException if the file cannot be opened/written.
Your main method should try to read/write the data (using setup and update
methods), appropriately handling exceptions (potentially by terminating
execution with a meaningful message but not by an uncaught exception). The
application should always keep up-to-date data.
Note: Your application should also elegantly handle exceptions occurring from
bad user input.
Some notes about the “flights.txt” file structure:
• First-line in the file: a number to show the number of flights we have
• After first line, you will have 6 lines for each flight. For example, if you
have 2 in the first line, you will have 12 lines after that. Every 6 lines is
related to a flight:
o “@Flight”: starting a flight information
o “@F_info”: the next line has flight information separated by ‘,’
(comma) character (i.e. flight_number,origin, destination,
departure_time, seat map type).
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz
COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
Criteria:
Weight:
o “@F_R_Seats”: the next line has the list of reserved seats
separated by ‘,’ (comma) character (i.e. seat_info_one,
seat_info_two, …). seat info contains row and column of Seat
separated by ‘_’ (underline) character (i.e., 1_A).
o “@@”:end of a flight information
Marking Scheme
Functionality of
SeatMap
classes
25%
Functionality of
Airline
classes
20%
Program’s
Runtime
Demonstration:
-Uniqueness
-Purpose
-Context
-Interactive
Code Quality:
-Whitespace
-Naming
-Reuse
-Modularity
-Encapsulation
Documentation
Standards:
-Algorithms
Commented
-Javadoc
30%
15%
10%
Grade A
Grade B
Grade C
Grade D
Grade Range:
100 ≥ x ≥ 80%
Grade Range:
80 > x ≥ 65%
Grade Range:
65 > x ≥ 50%
Grade Range:
50 > x ≥ 0%
OOP paradigm consistently
used for the
implementation of all
SeatMap functionality.
OOP paradigm consistently
used for the
implementation of all airline
functionality.
Inconsistent use of OOP
paradigm but the correct
implementation of SeatMap
functionality
Inconsistent use of OOP
paradigm but the correct
implementation of airline
functionality
Incorrect SeatMap
functionality and poor use of
OOP paradigm
Absent SeatMap
functionality or code does
not compile
Some basic functionality of
airline classes/poor usage of
abstract and concrete classes
Absent functionality of
airline classes or code does
not compile.
The object-oriented
program is unique,
purposeful, and provides an
elegant implementation of
the Airline Reservation
Application. The program is
interactive.
The object-oriented program
is unique, purposeful. A
reasonable implementation of
the Airline Reservation
Application.
The program is interactive.
The object-oriented program
features an incomplete
demonstration of the Airline
Reservation Application
Program is not interactive.
Absent functionality of
Airline Reservation
Application or code does not
run after compiling
Whitespace is
comprehensively consistent.
All naming is sensible and
meaningful. Code reuse is
present. The code is
modular. The code is well
encapsulated.
Whitespace is
comprehensively consistent.
The majority of naming is
sensible. The code is modular.
The code is encapsulated.
Whitespace is
comprehensively consistent.
The code has some
modularity.
The code has some
encapsulation.
Whitespace is inconsistent,
and hence code is difficult to
read.
The entire codebase has
comprehensive Javadoc
commenting. Algorithms are
well commented.
The majority of the codebase
features Javadoc
commenting. The majority of
algorithms are commented.
Some Javadoc comments
present. Some algorithms are
commented.
No Javadoc comments
present.
Javadoc Commenting
1. Your classes must have commenting of the form:
/**
* Comment describing the class.
* @author yourname studentnumber
**/
2. All methods must be commented with appropriate Javadocs metatags. For example:
/**
* A comment to describe the method
* @param a first parameter description
* @param b second parameter description
* @return a description of the returned result
* @author studentnumber
Dr. Seyedjamal Zolhavarieh, Auckland University of Technology, szolhava@aut.ac.nz

COMP503/ENSE502/ENSE602 _ Assignment 2
Sem 1 2020
* */
Authenticity
Remember!
• It is unacceptable to hand in any code which has previously been
submitted for assessment (for any paper, including Programming 2) or
available online
• All work submitted must be unique and your own!
Submission Instructions
Submit the following documents as an archive .zip file of your documents on
Blackboard before the deadline:
• Your full java project for assignment.
• Sample console output demonstrating your program in u…
Purchase answer to see full
attachment

Don't use plagiarized sources. Get Your Custom Essay on
COMP 503 Auckland institute of studies Airline Reservation System Java Application For this assignment, you will individually develop an Airline Reservatio
For $10/Page 0nly
Order Essay
Calculator

Calculate the price of your paper

Total price:$26

Need a better grade?
We've got you covered.

Order your paper