CPT121 / COSC2135 Programming 1 (OUA)

1 | P a g e
School of Science
CPT121 / COSC2135 Programming 1 (OUA)
Assignment 3

Assessment Type: Individual assignment; no group work. Submit online via Canvas→Assignments→Assignment 3.
Marks awarded for meeting requirements as closely as possible. Clarifications/updates may be made via
announcements/relevant discussion forums.
Due date: 11:59pm AEST Sunday November 17 (end of week 12); Deadlines will not be advanced, but they may
be extended. Please check Canvas→Syllabus or via Canvas→Assignments→Assignment 3 for the most up to
date information.
As this is a major assignment in which you demonstrate your understanding, a university standard late penalty of
10% per each working day applies for up to 5 working days late, unless special consideration has been granted.
Weighting: 20%

1. Overview
Important note:
This assessment will require you to apply various concepts and techniques covered in weeks 1-11 of the course, with a focus on
the object-oriented programming concepts covered in weeks 5-9, in order to assemble an object-oriented programmatic solution
for a problem based on a real-world scenario.
An important part of your development as a programmer is the ability to identify and apply appropriate techniques or
programming structures when implementing the various aspects of a programmatic solution to a given problem, so in addition to
the basic functional requirements of this task, you will also be assessed on your ability to select and utilize appropriate techniques
and structures in your solution.
Abstract:
You have been engaged to develop a Flight Bookings System for a company “TravelAdventure”. The scenario and system
requirements will be presented here in. You are expected to use object-oriented programming concepts such as inheritance and
polymorphism to complete this task.
2. Assessment Criteria
This assessment will require you to do the following:
1. Comprehend and address functional requirements of the proposed system as set out in this specification.
2. Independently solve the problem given by:
A. Identifying key data-related and functional aspects in the proposed system and using that information to model a
class which represents a blueprint for creating objects asrequired, using concepts covered in weeks 3 and 9.
B. Assembling a programmatic solution which brings together concepts taught over weeks 1-11 of the course, with an
emphasis on the object-oriented programming concepts covered in weeks 4-9, analysing components of the
problem and evaluating different approaches.
3. Write and debug Java code independently
4. Use appropriate coding style and document code appropriately.
5. Provide references where required.
6. Meeting deadlines.
7. Seeking clarification from your supervisor (instructor) when needed via Canvasdiscussions.
2 | P a g e
3. Learning Outcomes
This assessment is relevant to the following Learning Outcomes:
CLO 1: Solve simple algorithmic computing problems using basic control structures and programming techniques.
CLO 2: Design and implement a computer program based on analysing and modelling requirements
CLO 3: Identify and apply basic features of an Object-Oriented programming language using standard Java (Java SE)
language constructs and APIs
CLO 4: Identify and apply good programming style based on established standards, practices and coding guidelines. CLO
5 Devise and apply strategies to test the software.
4. Assessment details
4.1) Coding Style / Documentation (0.5 + 0.25 + 0.25 = 1.0 marks)
Your program should demonstrate appropriate coding style and documentation, which includes:
4.1.1) Code formatting and indentation (0.5 marks)

Code formatting and indentation is neat andconsistent
You may use any of the accepted code formatting styles – eg. One True Brace Style (1TBS), the standard eclipse Java

style or the supplied eclipse formatting style (which is an adaption of 1TBS), as long your code formatting is neat,
consistent, and indentation / positioning of each segment of code is correct, relative to the code segments around it.
• Lines of code should generally not exceed 80 characters in length where possible, maximum line length is 100
characters.
You should endeavour to split lines which will exceed the 80-character limit by a significant amount into two or more
segments where required (or think about whether you have one of the problems mentioned below), but any lines of
code which will exceed the 100-character limit must be split.
Note: It is good programming practice to try to keep lines of code short, as overly long lines can be indications of A) overly
verbose identifiers, B) overly complex data structures / algorithms (including nesting) or C) trying to do too much in the
one statement.
• Expressions and overall source code are spaced outappropriately
Use spaces between operators and operands to make expressions more readable and use blank lines strategically to separate
your code into logically related “segments”, to enhance code readability.
4.1.2 Use of appropriate identifiers (0.25 marks)
• Select appropriately descriptive identifiers for variables and methods which reflect the meaning of the value stored or
task the method is performing to improve code readability.
• Identifiers should generally not consist of more than 3-4 “words” and, where a variable stores a value which has a
specific unit of measurement, you should note that unit of measurement as the end of the identifier name (eg.
tripDistanceKm).
• Avoid abbreviations (especially heavy/repeated abbreviations) wherepossible.
• Class names should be in title case, method and variable names
4.1.3 Code documentation (0.25 marks)
Comments should be included with your code as per the below:
• A “header” comment describing the purpose of the class / program
• Comments for each logically related non-trivial segment of the code which describe the purpose the code segment or
goal the code is trying to achieve, especially for segments which implement logical steps in the process you are
implementing.
3 | P a g e
Your coding style and documentation will be assessed as follows:

Criteria Excellent Good Needs Improvement Poor
4.1.1
Code formatting
and indentation
(0.5 marks)
(0.5 marks)
Code formatting is neat
and consistent and
meets all expectations
to a professional
standard.
(0.4 marks)
Code formatting is
reasonably neat and
consistent – minor
issues noted with one
or more expectations
(0.2 marks)
Some evidence of
reasonable code
formatting – significant
issues noted with one
or more expectations
(0 marks)
Code formatting
generally does not
meet expectations and
is difficult to read.
4.1.2
Use of appropriate
identifiers
(0.25 marks)
(0.25 marks)
Identifiers for class,
methods and variables
consistently meet all
expectations to a
professional standard.
(0.2 marks)
Identifiers are
generally appropriate
in most cases but some
issues noted with one
or more expectations.
(0.1 marks)
Some evidence of
appropriate identifier
selection – significant
issues noted with one
or more expectations.
(0 marks)
Identifiers generally do
not meet expectations
and make code more
difficult to read /
comprehend.
4.1.3
Code
Documentation
(0.25 marks)
(0.25 marks)
Appropriate code
commenting included
for class, method(s)
and all-important
segments of code in the
program without being
too verbose.
(0.2 marks)
Code commenting
included at most points
where it is needed, but
some issues noted with
missing comments,
brevity or being
excessively verbose.
(0.1 marks)
Some evidence of
commenting in source
code – significant issues
noted with one or more
expectations.
(0 marks)
Minimal to no effort
made to include
comments which help
describe and put your
source code in context
for the reader.

Comments should be positioned on the line above statement(s) or structure they refer to, not on the same line.
An example of a good comment – concise and describes goal code is trying to achieve:
// calculate interest payable and new balance values
interest = balance + interestRate;
balance = balance + interest;
Examples of bad comments (reciting code):
// calculate the interest payable as the existing balance multiplied by the interest
// rate and store the result in the variable ‘interest’, then calculate the new balance
// as the existing balance plus the interest payable and overwrite the existing balance
// in the variable ‘balance’ with the new balance
interest =
balance =
// declare an int variable called ‘x’ and set it to the value ‘1’
int x = 1;
4 | P a g e
4.2) Functional requirements (Total: 1.0 + 1.0 + 1.5 + 1.0 + 8.5 = 13.0 marks)
The scenario for this assignment is presented as follows.
The TravelAdventure company established in 1970s is among the players in the world travel market. The company is seeking to
hire a programmer to design and develop a system that would simplify the booking of flights and accommodation. As a chosen
programmer to design and implement this system you are supplied with the transcribed text of the meeting between the company
manager and previous developer, who for some reasons could not develop the system.
The meeting between TravelAdventure Company and the developer is transcribed below.
Manager: We have managed to keep records of flights, their destination and price that I will share with you. We want a simple system
that will allow users to manage their bookings. We plan to cater for different types of bookings, but we will start with flight bookings
and holiday bookings.
Developer: What do you mean by flight bookings and holiday bookings?
Manager: A flight booking means a simple booking for a flight- no accommodation or car hire required, while holiday booking means
the booking is extended to accommodation (at this stage).
Manager: We have up to date record of flights, their destination and prices, so when users make their bookings, the system should
check if we have flights to the destination.
Developer: What will happen if a customer destination is not in your flight records?
Manager: Well, I am afraid, we will not proceed with such a booking.
Developer: OK, what else should the system do? Any reports at the end of the business day?
Manager: We need to process an invoice, we need to create itinerary and, of course, view all bookings made for the day.
Developer: Can you elaborate more what will be displayed in the invoice and itinerary?
Manager: Itinerary would have information such as booking ID (some call it booking reference), destination, flight number, departure
date, and passenger(s) names. Invoice should have invoice number, company name, flight number, flight cost per person, number of
passengers and the total cost. The number of nights and price per night should be added if the booking is for holiday.
Developer: Ok, what information would you like to be displayed when viewing all bookings?
Manager: View all bookings should show the booking details (booking number, destination, number passengers, flight number,
departure date) and accommodation details (hotel name, number of nights booked, check in date) for each booking.
Manager: The system should allow users who are holidaying to update accommodation bookings, that is, extending or shortening
their stay.
Developer: Should the system recalculate the cost or calculate the refund once user chose to update their stay?
Manager: No, the system should recalculate the new cost. At this stage, we are not processing payments.
Manager: At the end of the business day, we normally shutdown our systems. So apart from printing all the bookings, we would like
to save them to the files.
Developer: Noted.
****End****
The requirements for this task based on transcription above is split across several stages, where each stage incrementally builds
on the functionality implemented in the previous stage(s).
• Stage 1 – Booking class (Week 3 – writing classes)
• Stage 2 – FlightBooking and HolidayBooking subclasses (Week 7 – Inheritance)
• Stage 3 – Update Booking class (Week 9 – Abstract classes)
• Stage 4 – BookingManagementSystem (Week 6-9 – working with arrays ofobjects, Polymorphism and collection)
• Stage 5 – Updating Booking, FlightBooking and HolidayBooking Functionality (Week 10 – Exception Handling)
• Stage 6 – File Handling functionality (Week 11 – File Handling)
You should progress through each of the stages in turn, ensuring that you test the functionality you have implemented to ensure
that it is working according to specification, before moving onto the next stage.
5 | P a g e
4.2.1) Stage 1 – Modelling and implementing a class to represent Booking class (1.0 marks)
In this stage you will be designing and implementing a Booking class to be used to instantiate objects of its subclasses to be
defined in stage 2.
In this stage, you need to
1. Define instance variables for Booking class according to the transcribed text above
2. Define the constructor that will be invoked to instantiate objects
3. Define necessary accessors and mutators
4. Define a method to calculate Booking cost.
5. Define a method to print details of Booking object.
IMPORTANT NOTES WHEN REVIEWING THIS CLASS:
The previous developer has adhered to all relevant object-oriented programming guidelines, including:
• Visibility of instance variables and methods setappropriately
• Instance variable initialisation is carried out in the constructor only
• No unnecessary accessors (getters) or mutators (setters) – only provide methods which will be needed when
implementing the application class in stages 4.
• Methods should work with instance variables when performing theirrequired task
• Parameter lists in methods should be appropriate to the task the method is performing – only accept parameters
where a method requires one or more values from the caller to perform its assigned task that it does not already
have access to.
• Methods which need to communicate a value or result back to the caller should do so by returning the value in
question, not by storing it in an instance variable or printing it to the screen.
• Subclass methods should re-use methods from the superclass to help perform aspects of the required task as needed.
• Data classes should not implement any application-level functionality – eg. prompting for / getting input from the
user, managing a collection of objects at a high level, etc.
When you are working on other aspects of this system in later stages of this assignment you will be expected to adhere to
these same object-oriented programming guidelines.
Functional requirements for Stage 1 will be assessed as follows:

Criteria Excellent Good Needs Improvement Poor
4.2.1
Instance variable /
constant definitions
(0.25 marks)
(0.25 marks)
Instance variables of
appropriate type
defined for all
required values. No
additional instance
variables declared at
class level – visibility
of instance variables
set to private as per
good object-oriented
programming
practice.
(0.2 marks)
All required instance
variables and constants
defined – some issues
noted with types chosen or
visibility of instance
variables, additional
instance variables which
should be declared locally
within the methods that
use them
(0.1 marks)
Some evidence of an
attempt to define
required instance
variables and
constants – significant
issues with missing
variables, or incorrect
visibility.
(0 marks)
Code
implemented
instance
variable /
constant
definitions
generally do not
meet
expectations
and is not
functional or is
absent
altogether.
4.2.1
Constructor / Accessors
(0.25 marks)
(0.25 marks)
Constructor defined
correctly allowing
class user to create
and initialise new
Booking with values
passed in as
parameters.
Accessors (getters)
(0.2 marks)
Constructor and all
required accessors defined
as required – some issues
noted with constructor
parameters / instance
variable initialisation, or
with additional accessors
and/or mutators provided
(0.1 marks)
Some evidence of an
attempt to define
constructor and/or
accessors – significant
issues noted with one
or more expectations,
or code is not
functional.
(0 marks)
Code
implemented
for constructor
and accessors
generally does
not meet
expectations
and is not

6 | P a g e

implemented
correctly and only for
instance variables
the class user needs
to retrieve, no
additional accessors
or mutators
included.
which shouldn’t be
included in the class
definition.
functional or is
absent
altogether.
4.2.1
calculate
BookingCost(FlightRecords
fr) method
(0.25 marks)
(0.25 marks)
The method to
calculate booking
cost define with a
correct method
signature that takes
in Flight record
reference
(0.2 marks)
calculate
BookingCost(FlightRecords
fr) method defined – some
issues noted with method
signature or input
parameter or return type.
(Not in use) (0 marks)
Code
implemented
for calculating
booking cost
generally does
not meet
expectations
and is not
functional, or is
absent
altogether
4.2.1
printBookingDetails()
method
(0.25 marks)
(0.25 marks)
printBookingDetails()
method defined –
method signature
correct, Booking
details printed in
near / labelled
format as required.
(0.2 marks)
printBookingDetails()
method defined – some
issues noted with method
signature or printing of
Booking details (eg.
missing details, output not
formatted / labelled
neatly, etc)
(0.1 marks)
Some evidence of an
attempt to
implement
printBookingDetails()
method – significant
issues noted with one
or more expectations,
or code is not
functional.
(0 marks)
Code
implemented
for printing of
Booking details
generally does
not meet
expectations
and is not
functional, or is
absent
altogether

4.2.2) Stage 2A – FlightBooking Subclass (1.0 marks)
In stage 2A you will design and implement a FlightBooking class that extends Booking class to be used to instantiate
FlightBooking objects. This class should apply inheritance concept by creating FlightBooking objects with additional instance
variables only (if any, depending on your design and transcript above). The class should also define any accessor or mutator
required to facilitate application-level functionality defined in the later stages.
In this stage, you need to
1. Define any additional instance variable(s) for this class
2. Define the constructor that will be invoked to instantiate objects
3. Define necessary accessors and mutators specifically for this subclass
4. Override a method to calculate Booking cost for FlightBooking object.
5. Override a method to print details of FlightBooking object.
7 | P a g e
Functional requirements for Stage 2A will be assessed as follows:

Criteria Excellent Good Needs Improvement Poor
4.2.2
Instance
variable /
constant
definitions
(0.25 marks)
(0.25 marks)
Instance variables of
appropriate type
defined for all required
values. No additional
instance variables
declared at class level –
visibility of instance
variables set to private
as per good object
oriented programming
practice.
(0.2 marks)
All required instance
variables and constants
defined – some issues noted
with types chosen or
visibility of instance
variables, additional
instance variables which
should be declared locally
within the methods that use
them
(0.1 marks)
Some evidence of an
attempt to define
required instance
variables and constants –
significant issues with
missing variables, or
incorrect visibility.
(0 marks)
Code implemented
instance variable /
constant definitions
generally do not meet
expectations and is
not functional or is
absent altogether.
4.2.2
Constructor /
Accessors
(0.25 marks)
(0.25 marks)
Subclass constructor
defined correctly
allowing super class to
instantiate the rest of
the instance variables.
Additional instance
variable defined and
instantiated. Accessor
(getter) implemented
correctly.
(0.2 marks)
Subclass constructor and all
required accessors defined
as required – some issues
noted with constructor
parameters / instance
variable initialisation, or with
additional accessors and/or
mutators provided which
shouldn’t be included in the
class definition.
(0.1 marks)
Some evidence of an
attempt to define
subclass constructor
and/or accessors –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
Code implemented
for subclass
constructor and
accessors generally
does not meet
expectations and is
not functional or is
absent altogether.
4.2.2
Overriding
calculate
BookingCost(
FlightRecords
fr) method
(0.4 marks)
(0.4 marks)
calculate
BookingCost(FlightRec
ords fr) method
overridden correctly in
the subclass – return
type / method
signature, calculations
of booking cost for the
subclass correctly
implemented.
(0.25 marks)
calculate
BookingCost(FlightRecords
fr) method overridden –
some issues noted with
method signature or
calculations of booking cost.
(0.1 marks)
Some evidence of an
attempt to override
calculate
BookingCost(FlightRecor
ds fr) method – significant
issues noted with one or
more expectations, or
code is not functional.
(0 marks)
Code implemented to
override calculate
BookingCost(FlightRe
cords fr) generally
does not meet
expectations and is
not functional, or is
absent altogether.
4.2.2
Overriding
printBooking
Details()
method
(0.1 marks)
(0.1 marks)
printBookingDetails()
method overridden
correctly in the
subclass , FlightBooking
details printed in near /
labelled format as
required.
(0.05 marks)
printBookingDetails()
method overridden – some
issues noted with method
signature or printing of
FlightBooking details (eg.
missing details, output not
formatted / labelled neatly,
etc)
(Not in use) (0 marks)
Code implemented to
override the printing
of FlightBooking
details generally does
not meet
expectations and is
not functional, or is
absent altogether

8 | P a g e
4.2.3) Stage 2B– HolidayBooking subclass (1.5 marks)
In stage 2B you will design and implement a HolidayBooking class that extends Booking class to be used to instantiate
HolidayBooking objects. This class should apply inheritance concept by creating HolidayBooking objects with additional
instance variables depending on your design and transcript above. The class should also define any accessor or mutator
required to facilitate application-level functionality defined in the later stages.
In this stage, you need to
1. Define any additional instance variable(s) related to the holiday booking
2. Define the constructor that will be invoked to instantiate objects
3. Define necessary accessors and mutators specifically for this subclass
4. Override a method to calculate Booking cost for HolidayBooking object.
5. Override a method to print details of HolidayBooking object.
Functional requirements for Stage 2B will be assessed as follows:

Criteria Excellent Good Needs Improvement Poor
4.2.3
Constructor /
Accessors
(0.25 marks)
(0.25 marks)
Subclass constructor
defined correctly
allowing super class to
instantiate the rest of
the instance variables.
Additional instance
variable defined and
instantiated. Accessor
(getter) implemented
correctly.
(0.2 marks)
Subclass constructor
and all required
accessors defined as
required – some issues
noted with constructor
parameters / instance
variable initialisation,
or with additional
accessors and/or
mutators provided
which shouldn’t be
included in the class
definition.
(0.1 marks)
Some evidence of an
attempt to define
subclass constructor
and/or accessors –
significant issues
noted with one or
more expectations, or
code is not functional.
(0 marks)
Code implemented for
subclass constructor
and accessors
generally does not
meet expectations and
is not functional or is
absent altogether.
4.2.3
Overriding
calculate
BookingCost(FlightRec
ords fr) method
(1.0 marks)
(1.0 marks)
calculate
BookingCost(FlightRec
ords fr) method
overridden correctly in
the subclass – return
type / method
signature, calculations
of booking cost for
flight and
accommodation in the
subclass correctly
implemented.
(0.25 marks)
calculate
BookingCost(FlightRec
ords fr) method
overridden – some
issues noted with
method signature or
calculations of booking
cost or
accommodation cost
(0.1 marks)
Some evidence of an
attempt to override
calculate
BookingCost(FlightRec
ords fr) method –
significant issues
noted with one or
more expectations, or
code is not functional.
(0 marks)
Code implemented to
override calculate
BookingCost(FlightRec
ords fr) generally does
not meet expectations
and is not functional or
is absent altogether.
4.2.3
Overriding
printBookingDetails()
method
(0.25 marks)
(0.25 marks)
printBookingDetails()
method overridden
correctly in the
subclass,
HolidayBooking details
printed in near /
labelled format as
required.
(0.2 marks)
printBookingDetails()
method overridden –
some issues noted
with method signature
or printing of
HolidayBooking details
(eg. missing details,
output not formatted /
labelled neatly, etc)
(0.1 marks)
Some evidence of an
attempt to override
printBookingDetails()
method – significant
issues noted with one
or more expectations,
or code is not
functional.
(0 marks)
Code implemented to
override the printing
of HolidayBooking
details generally does
not meet expectations
and is not functional or
is absent altogether.

9 | P a g e
4.2.4) Stage 3 –Updating Booking Class (1.0 marks)
In the transcribed text above, the manager mentioned two types of Bookings. The Flight booking where the users only book
a flight and the holiday bookings where users book for both flight and accommodation. As we are specifically modelling flight
bookings and holiday bookings, there is no specific need to manage a “general” booking.
There will, however, still be a need from an object-oriented programming perspective to take advantage of inheritance to
ensure that the flight booking and holiday booking types are well-encapsulated, as well as taking advantage of polymorphism
where appropriate to work with both types of bookings in a transparent manner, especially when calculating booking costs.
Given the above you are required update the Booking class definition to A) reflect that we no longer need to work with basic
Booking objects and B) continue the process of calculating booking costs in a polymorphic manner, even though this process
will no longer apply to the basic Booking type.
Your implementation for Stage 3 of this assignment will be assessed as follows:

Criteria Excellent Good Needs Poor
4.2.4
Update Booking class
(0.5 marks)
(0.5 marks)
Booking class definition
updated to reflect that we
no longer need to
instantiate objects from this
class.
(not in use) (not in use) (0 marks)
Booking class definition
not updated
appropriately.
4.2.4
Update
calculateBookingCost(Flig
htRecords fr) method
(0.5 marks)
(0.5 marks)
The calculateBookingCost(
FlightRecords fr) method
updated to reflect that there
is no implementation for this
basic Booking type while still
allowing for this operation
to be polymorphic.
(not in use) (not in use) (0 marks)
calculateBookingCost(
FlightRecords fr) method
not updated
appropriately.
4.2.5) FlightRecords class (provided)
This class keeps records of scheduled flights, flight destinations and the cost. According to the company manager, the
records are updated on daily basis. Information from this class should be used by system users when making a booking,
as the company only approves bookings whose destinations are recorded in this class. The following information should
be retrieved from this class
1. Flight number- should be retrieved after passenger has provided booking destination when making a booking.
2. Flight cost- should be retrieved when calculating flight cost for booking invoice
3. Flight destination- should be checked before the booking is approved/ booking object is created.

10 | P a g e
4.2.5) Stage 4 – BookingManagementSystem (8.5 marks)
In this stage you will be implementing a console-driven application in Java which provides functionality to the user allowing
them to create, store and manage Booking (FlightBooking and HolidayBooking) objects in the system. You should use the
BookingManagementSystem.java file supplied for this assignment.
A summary of the system requirements for this stage is presented below:
“A menu-driven system which allows users to manage bookings – features the company plan on using on a day-today basis include the following:
A- Book a Flight
The user will provide all relevant details required to book for a flight, i.e destination, departure date, number of passengers
and their names and bookingID (which can be generated by the system or added manually). Once all relevant details have
been read, the system should create a FlightBooking object. Note: this feature should call the constructor which in turn
interact with FlightRecords class to check whether there is a flight to the passenger destination. If there are no flight to the
destination, the feature should not create the booking and the user should be notified. If there is a flight to destination, the
flight number information should be searched from the FlightRecords class and assigned to the instance variable for flight
number.
B- Book a Holiday
The user will provide all relevant details required to book for a flight, i.e destination, departure date, number of passengers
and their names and bookingID (which can be generated by the system or added manually), hotel name, number of nights,
price per night and check-in date. Once all relevant details have been read, the system should create a FlightBooking object.
Note: this feature should call the constructor which in turn interact with FlightRecords class to check whether there is a
flight to the passenger destination. If there are no flight to the destination, the feature should not create the booking and
the user should be notified. If there is a flight to destination, the flight number information should be searched from the
FlightRecords class and assigned to the instance variable for flight number.
C- View Invoice
The user will provide the booking Id to view the invoice. The program should search for the existence of such bookingID
using appropriate method calls. If the bookingID is found, the number of passengers, hotel prices and rate per night (if
applicable) should then be retrieved from the booking and cost for the booking be calculated polymorphically using
appropriate method call. The booking cost should be recorded for future reference. The invoice should be printed to the
screen in a clear, readable and neat format and should contain the following information- BookingID, Passenger name,
destination, price per flight and total cost. For Holiday booking, accommodation information should be added such as
number of nights, price per night and total cost (flight cost and accommodation costs). Users should be notified for failed
search.
D- Print Itinerary
The user will provide the booking Id to print itinerary. The system should search for the existence of such bookingID using
appropriate method calls. If the bookingID is found, the system should print itinerary for the specified bookingID in a clear,
readable and neat format. The itinerary should list the bookingID, flight number, departure time, destination and passenger
name(s).
E- View Bookings
This feature should call appropriate method polymorphically to display all bookings in the system- FlightBooking and
HolidayBooking and their details in a clear, readable and neat format.
F- Update Check in Details
The user will provide the booking Id to update accommodation details. The system should search for the existence and type
of such bookingID using appropriate method calls. User should then supply the number of days after which the system calls
appropriate methods to update the number of nights and re calculate the Booking cost.
Note: at this stage we allow change of check in dates by either extending or shortening the days of stay.
11 | P a g e
Your implementation for Stage 4 of this assignment will be assessed as follows:

Criteria Excellent Good Needs Improvement Poor
4.2.5
A collection to store
Bookings
(1.0 marks)
(1.0 marks)
Collection created to
store bookings
appropriately
(not in use) (not in use) (0 marks)
No collection created
to store Bookings.
4.2.5
bookAFlight feature
(1.0 marks)
(1.0 marks)
User prompted to enter
required details and a
FlightBooking object
created and stored in
collection of Bookings
correctly.
(0.5 marks)
A bookAFlight feature
implemented – some
issues noted with
creation of FlightBooking
object or storing of
FlightBooking objects in
collection of Bookings.
(0.2 marks)
Some evidence of an
attempt to create a
FlightBooking and/or
add it to collection of
Bookings – significant
issues noted with one or
more expectations, or
code is not functional.
(0 marks)
Code implemented
for creating
FlightBooking objects
generally does not
meet expectations
and is not functional
or is absent
altogether.
4.2.5
bookAHoliday
feature
(1.0 marks)
(1.0 marks)
User prompted to enter
required details and a
HolidayBooking object
created and stored in
collection of Bookings
correctly.
(0.5 marks)
A bookAHoliday feature
implemented – some
issues noted with
creation of
HolidayBooking object
or storing of
HolidayBooking objects
in collection of Bookings.
(0.2 marks)
Some evidence of an
attempt to create a
HolidayBooking and/or
add it to collection of
Bookings – significant
issues noted with one or
more expectations, or
code is not functional.
(0 marks)
Code implemented
for creating
HolidayBooking
objects generally
does not meet
expectations and is
not functional or is
absent altogether.
4.2.5
View Invoice feature
(1.5 marks)
(1.5 marks)
User prompted to enter
the bookingID. A search
for the booking object
was appropriately done.
Correct method calls to
collect information to
create an invoice were
performed
polymorphically.
Booking cost correctly
calculated.
Failed search was
reported to the user.
(1.0 marks)
View Invoice feature
implemented – some
issues noted with
method calls or cost
calculations or search for
bookingID or reporting
failed search.
(0.5 marks)
Some evidence of an
attempt to view Invoice
feature – significant
issues noted with one or
more expectations, or
code is not functional.
(0 marks)
Code implemented
for viewing Invoice
generally does not
meet expectations
and is not functional
or is absent
altogether.
4.2.5
View Itinerary
feature
(1.0 marks)
(1.0 marks)
User prompted to enter
the bookingID. A search
for the booking object
was appropriately done.
Correct method calls to
collect information to
create an itinerary were
performed The
Feature report failed
searches back to the user
appropriately.
(0.5 marks)
View Itinerary feature
implemented – some
issues noted with
method calls or search
for bookingID or
reporting failed search
(0.2 marks)
Some evidence of an
attempt to implement
view Itinerary feature –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
Code implemented
for viewing Itinerary
generally does not
meet expectations
and is not functional
or is absent
altogether.

12 | P a g e

4.2.5
View Bookings
feature
(1.0 marks)
(1.0 marks)
Full details for all
bookings in the system
displayed by calling
appropriate method for
each object correctly –
appropriate iteration
structure used to step
through collection of
Bookings currently
stored.
(0.5 marks)
View Bookings feature
implemented – some
issues noted with how
Booking details are
displayed or iteration
through collection of
Bookings currently
stored.
(0.2 marks)
Some evidence of an
attempt to implement
view Booking feature –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
Code implemented
for viewing Bookings
generally does not
meet expectations
and is not functional
or is absent
altogether.
4.2.5
UpdateCheckinDate
Feature
(2.0 marks)
(2.0 marks)
User prompted to enter
the bookingID. A search
for the booking object
was appropriately done.
Correct method calls to
collect information to
update check in dates
were performed
polymorphically.
New booking cost was
calculated and recorded
against the object in
question. Failed search
was reported to the user.
(1.5 marks)
The updatecheckin Date
feature implemented –
some issues noted with
method calls or cost
calculations or search for
bookingID or reporting
failed search.
(1.0 marks)
Some evidence of an
attempt to update
checkin dates feature –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
Code implemented
for updating checkin
dates generally does
not meet
expectations and is
not functional or is
absent altogether.

Page 13 of 17
4.2.6) Stage 5 – Adding exception handling to existing functionality (2.0 marks)
In this stage you will be refactoring some of the code from previous stages to take advantage of exception handling to signal
when an error has occurred, instead of relying on values returned from a method call.
In order to do so you will need to follow the steps below.
A) Define a custom BookingException type (0.2 marks)
Define your own custom exception type BookingException, which represents an issue that occurs when attempting to
create a FlightBooking or HolidayBooking objects.
This BookingException class should allow a suitable error message to be specified when a new BookingException object
is created.
This class should be in its own separate source code (.java) file.
B) Refactor the constructor in the Booking, FlightBooking and HolidayBooking classes
(0.5 + 0.25 + 0.25 = 1.0 marks)
Update constructors for Booking, FlightBooking and HolidayBooking so that the BookingException containing a suitable
error message is generated and thrown when there is no flight having the same destination as passengers.
This will initially require the rewriting of the constructor in the Booking class so that a BookingException is thrown when
Booking flight cannot be created.
Also note that any exception that is thrown should be allowed to propagate back up to the calling method, exceptions
should not be caught locally within the Booking, FlightBooking and HolidayBooking constructors.
C) Refactoring bookingAFlight() and bookingAHoliday() functionality in BookingManagementSystem
class (0.8 marks)
Update the existing functionalities for bookingAFlight and bookingAHoliday features from Stage 4 so they catch
BookingException that may have been thrown and display the error embedded within the BookingException object that
have been caught.
IMPORTANT NOTES WHEN IMPLEMENTING THIS APPLICATION CLASS:
• You should be working with the Booking, FlightBooking, HolidayBooking and BookingManagementSystem classes
code you have implemented – your ability to engage problem-solving skills to identify how to implement the
required exception handling code within the existing implementation of these classes is an important part of this
task.
• You will only need to update the bookingAFlight and bookingAHoliday functionalities (methods) in the program
to incorporate exception handling into the process of booking a flight and booking a holiday – you do not need to
implement a completely new version of the relevant methods.
Page 14 of 17
Functional requirements for Stage 5 will be assessed as follows:

Criteria Excellent Good Needs Improvement Poor
4.2.6
BookingException
definition
(0.2 marks)
(0.2 marks)
BookingException
defined correctly as
subclass of Exception.
Suitable constructor
defined accepting class
user-defined error
message as a
parameter.
(0.15 marks)
BookingException
defined – some
issues noted with
class definition or
constructor.
(0.1 marks)
Some evidence of an
attempt to define
BookingException type –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
BookingException
definition generally
does not meet
expectations and is
not functional, or is
absent altogether.
4.2.6
Updating
Constructor in the
Booking class
(0.5 marks)
(0.5 marks)
Booking class
constructor updated
so that a booking is
rejected by throwing a
BookingException when
Flight and passenger
destinations are not the
same
BookingException
allowed to propagate
back up to caller when
one is thrown.
(0.3 marks)
Booking class
constructor updated –
some issues noted
with throwing or
propagation of
thrown
BookingException
back up to the caller,
or other unnecessary
changes have been
made to constructor
implementation.
(0.1 marks)
Some evidence of an
attempt to update the
Booking class
constructor by throwing
a BookingException –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
The Booking class
constructor update to
incorporate exception
handling generally
does not meet
expectations and is
not functional or is
absent altogether.
4.2.6
Updating
Constructor in the
FlightBooking and
HolidayBooking
classes
(0.5 marks)
(0.5 marks)
FlightBooking and
HolidayBooking
classes constructors
are updated
so that any booking is
rejected by throwing a
BookingException when
Flight and passenger
destinations are not the
same
BookingException
allowed to propagate
back up to caller when
one is thrown.
(0.3 marks)
FlightBooking and
HolidayBooking
classes constructors
are updated
– some issues noted
with throwing or
propagation of
thrown
BookingException
back up to the caller,
or other unnecessary
changes have been
made to constructor
implementation.
(0.1 marks)
Some evidence of an
attempt to update the
FlightBooking and
HolidayBooking classes
constructors by
throwing a
BookingException –
significant issues noted
with one or more
expectations, or code is
not functional.
(0 marks)
The FlightBooking
and HolidayBooking
classes constructors
are updated to
incorporate
exception handling
generally does not
meet expectations
and is not functional
or is absent
altogether.
4.2.6
Updating
bookAFlight()
functionality at
BookingManagement
System application
class level.
(0.4 marks)
(0.4 marks)
bookAFlight()
functionality updated
to catch any exception
that may be thrown
when calling a
constructor.
Embedded error
message inside caught
exception is displayed
to screen. Redundant
code to check for
rejection signal
removed.
(0.3 marks)
bookAFlight()
functionality updated
– some issues noted
with catching of
exception, displaying
of error message or
removing of
redundant code to
check for rejection
signal.
(0.2 marks)
Some evidence of
attempt to update
bookAFlight()
functionality – significant
issues noted with one or
more expectations, or
code is not functional.
(0 marks)
Code update for
catching
BookingException in
bookAFlight() feature
generally does not
meet expectations
and is not functional
or is absent
altogether.

Page 15 of 17

4.2.6
Updating
bookAHoliday()
functionality at
BookingManagement
System application
class level.
(0.4 marks)
(0.4 marks)
bookAHoliday()
functionality updated
to catch any exception
that may be thrown
when calling a
constructor.
Embedded error
message inside caught
exception is displayed
to screen.
Redundant code to
check for rejection
signal removed.
(0.3 marks)
bookAHoliday()
functionality updated
– some issues noted
with catching of
exception, displaying
of error message or
removing of
redundant code to
check for rejection
signal.
(0.2 marks)
Some evidence of
attempt to update
bookAHoliday()
functionality – significant
issues noted with one or
more expectations, or
code is not functional.
(0 marks)
Code update for
catching
BookingException in
bookAHoliday()
feature generally does
not meet expectations
and is not functional
or is absent
altogether.

4.2.7 Stage 6 – implementing object persistence (2.0 + 2.0 = 4.0 marks)
As the manager pointed out in the meeting with previous programmer, you need to implement an approach to writing out
booking information in the system before shutting down at the end of the day, so that it may be restored again when the
system is started up the next morning.
Your task here is to design an approach to writing out information for all flightbookings and holidaybookings currently stored
in the system in such a way that they can be reconstructed in full. Then, implement functionality to:
A) extract details for all objects currently in the system and write the information out to a text file (in a format which will allow
the same set of objects to be restored in full later) when the user chooses to exit the program,and
B) read the information back in from the text file and use it to restore the existing set of objects in full and store them back in
the attractions array when the program starts up.
How you choose to approach this task is up to you, but you should note the points below when designing and implementing
your solution.
IMPORTANT NOTES WHEN ATTEMPTING THIS STAGE:
• Your program for stages 1-5 must be complete and running correctly before attempting this stage.
• Your text file location should be relative to your project workspace – there is no need to specify a full path and your
solution will lose marks if it opens a file with a path that exists on your local machine, rather than one relative to the
project workspace.
• If there is no data file, then the program should note that no data was loaded and proceed to run in an “empty” state
(ie. display program menu and allow the user to start using theprogram).
• You may add additional functionality to the underlying Booking, FlightBooking and HolidayBooking classes, however,
in doing so you should be mindful that instance variables should still be protected from arbitrary changes (ie. visibility
should be private, and you should avoid defining simple mutators for instance variables wherepossible).
• You are not permitted to use automatic object serialization in your implementation of this functionality. Your solution
must manually extract the relevant information from each object in the system and write that information out to a
text file in a structured manner, when the program is exited, after which it should then read in the information from
the same text file and use it to restore the same set of objects, when the program is next started.
• You are encouraged to share and discuss potential approaches to various aspects of this task in with your peers in
the Canvas discussions for this assignment, but you should refrain from revealing any code you have written and the
code for any solution you come up with must be of your own creation.
• Your implementation of this functionality should otherwise follow all relevant object-oriented programming
guidelines as outlined in previous stages of thisassignment.
Page 16 of 17
Functional requirements for Stage 6 functionality will be assessed as follows:

Criteria Good Needs Improvement Poor
4.2.7
Writing Booking
information out to
file.
(2.0 marks)
(2.0 marks)
Appropriate strategy chosen
for writing details for
Booking objects out to file
chosen.
Details for Booking objects
extracted and written out in
full.
File structure allows for
object types to be identified
later when attempting to
reconstruct the same objects.
Solution adheres to good
object-oriented programming
guidelines.
(1.0 marks)
Some evidence of an attempt
design and implement a file
storage mechanism for
Bookings in the system – issues
noted with one or more
expectations regarding
completeness or structure of
data written out to file.
(0 marks)
Code implemented for storing
information for Bookings
generally does not meet
expectations and is not largely
functional or is absent altogether.
4.2.7
Reconstructing
/reading in details
of objects from
Booking
(2.0 marks)
(2.0 marks)
Appropriate strategy chosen
for reading in the details for
Bookings from file and
reconstructing those objects
in the system. Details for
Booking objects restored in
full and corresponding objects
are stored in the attractions
array as they were when the
program was last exited.
(1.0 marks)
Some evidence of an attempt
design and implement a file
reading / object reconstruction
mechanism for Bookings in the
system – issues noted with one
or more expectations regarding
completeness of objects
restored from data in the file.
(0 marks)
Code implemented for reading
information for Bookings from
file and reconstructing the
corresponding objects generally
does not meet expectations and
is not largely functional or is
absent altogether.

5. Referencing guidelines
What: This is an individual assignment, and all submitted code must be your own.
If you have used examples of code from sources other than the contents directly under Canvas→Modules, or the recommended
textbook (eg. an example from the web or other resource) as the basis for your own code then you should acknowledge the
source(s) and give references using IEEE referencing style.
Where: Add a block code comment near the work to be referenced and include the reference in the IEEE style.
How: To generate a valid IEEE style reference, please use the citethisforme tool if unfamiliar with this style.
6. Submission instructions
6.1 – Preparing for submission
You should test your program thoroughly to ensure it is implementing the required program logic correctly before
submitting – discussion regarding tests and results in the Canvas discussion for this assignment is highly encouraged.
It is the responsibility of the student to correctly submit the latest version files. Please verify that your submission is correct
and includes the latest version of your program code by downloading what you have submitted to ensure your submission
includes the correct contents.
Any resubmission that is required in situations where the file(s) submitted prior to the submission deadline are not the
latest version of your program code will be considered as a late submission and may incur late submission penalties
accordingly.
Page 17 of 17
6.2 – Submission format
Submit your java course code file (or eclipse project) via Canvas→Assignments→Assignment 2.
6.3 – Submission deadline / late submission penalties
The submission deadline for this assignment is 11:59pm AEDT Sunday November 17, 2019.
Submissions made after this time without an extension of time being granted prior to the submission deadline will be
considered late.
For each day late (or part thereof) 10% of the available marks for this assessment will be deducted, up to a maximum of 5
days.
Any submission received more than 5 days late without an extension of time having been being granted will be penalised
the full 100% of the marks available.
Any requests for extensions of time to submit or adjustments to assessment as part of an Equitable Learning Plan should be
forwarded to the instructor a minimum of one business day prior to the submission deadline, ie. on or before the Thursday prior
to the submission deadline as per assessment / reasonable adjustments policy.
7. Academic integrity and plagiarism (standard warning)
Academic integrity is about honest presentation of your academic work. It means acknowledging the work of others while
developing your own insights, knowledge and ideas. You should take extreme care that you have:
• Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you have quoted (i.e. directly
copied), summarised, paraphrased, discussed or mentioned in your assessment through the appropriate referencing
methods,
• Provided a reference list of the publication details so your reader can locate the source if necessary. This includes
material taken from Internet sites.
If you do not acknowledge the sources of your material, you may be accused of plagiarism because you have passed off the
work and ideas of another person without appropriate referencing, as if they were your own. RMIT University treats plagiarism

as a very serious offence constituting misconduct.
including:
Plagiarism covers a variety of inappropriate behaviours,

• Failure to properly document a source
• Copyright material from the internet ordatabases
• Collusion between students
For further information on assessment policies and procedures, please refer to the University website.
8. Assessment declaration
When you submit work electronically, you agree to the assessment declaration.
9. Assessment criteria
Please refer to the embedded in each section of the assignment requirements above for guidance on grading.
When clients state their requirements, it is normal that the programmer (you) might need further clarification. If you are
uncertain, consider the instructor as the client and post your questions in the specification discussion for this assignment
in Canvas in a general way (without posting your sourcecode).

Leave a Reply

Your email address will not be published.