Professional Documents
Culture Documents
Assignment Overview: Java, Python, and Lisp
Assignment Overview: Java, Python, and Lisp
You are tasked with creating a text-based program for storing data on Hotel Room Bookings - however, as this
is a comparative languages course, you will be creating the same application in the following three programming
languages:
• Java,
• Python, and
• Lisp
As you implement the application in each language you should keep notes on:
A brief discussion document based on these programming features for each individual language accompanying
each implementation is required. Finally, a comparative overview of the languages highlighting how they were
suitable or not suitable for the creating this type of application is also required.
It is recommended that the first version of the application you write is in the programming language which is
most familiar to you. This will help you to have a working 'template' for storing room bookings which you can
then translate into the other programming languages.
Program Specification
When the program first launches, there is a menu which allows the user to select one of the following five
options:
1.) When users add a guest they provide a name which is stored in some manner of array or list. Guests are
assigned a unique ID value where the first guest added is assigned the ID value 1, the second guest added
is assigned the ID value 2 and so on.
2.) When users add a room they provide a room number and a room capacity (i.e. how many people can
stay in the room at any one time) which is stored in some manner of array or list. Rooms have a property
which indicates if they are booked or not for any given date – please see the Room Booking Dates section
below for some guidance on the easiest way to implement this.
3.) When users add a booking they provide a guest ID, room number, the number of guests staying and
finally a check-in date and check-out date.
• The room must be able to accommodate the number of people in the booking (i.e. if the room
capacity is for 2 people and the booking has 4 people staying then the booking must be refused),
and finally
4.) When users views bookings they have the option to:
a. View guest bookings, or
b. View room bookings.
If the user opts to show guest bookings then they are prompted to enter the guest ID - and then any
bookings made by that guest are displayed including:
If the user opts to show room bookings then they are prompted to enter a room number - and then any
bookings for that room within the current year are displayed, including:
5.) When a user chooses to Quit the program terminates with a goodbye message.
Each implementation of your project (in each of the three languages you choose) should aim to closely match
the setup and structure of the program as shown in the example output on the following pages.
You may wish create separate Guest, Room and potentially Booking classes as part of your implementations,
but you do not have to.
You may also wish to add code to pre-create a number of guests, rooms and bookings on each run of your code
to avoid the need to type in these details over and over when testing your program. If you do so, please
comment out these pre-defined entries before submitting your assignment.
Dates can be a complex subject to do correctly in programming because we often want to calculate how many
days are between dates, and there are issues like date formats (dd/mm/yy? mm/dd/yyyy?) to consider as well
as leap years where February has 29 days instead of the usual 28 and so on.
Some programming languages come with built-in classes to work with dates – and you may use them if you
wish. In fact, you are encouraged to use them as they are precisely what you would use when working in the
real world, so experience in them now will increase your programming knowledge!
However, to keep things simple, our room booking system will only allow bookings within the current year, and
the easiest way to do that is to store dates as the number of the day between 1 and 365. So, day 18 would be
the 18th of January (which has 31 days), day 32 would be the 1st of February, and so on.
As such, one way to keep track of whether a room is booked or not for a current day would be for each room to
have an array of 365 boolean values which are all set to false (i.e. room is not booked for that particular day)
when the room is first created.
Then, because users don’t like entering dates as values between 1 and 365, we could have four utility methods:
Example code for the first tree of these methods, written in a Java-like syntax, is provided on the following page – you
should write the setBooked method yourself. The above setBooked method signature assumes you are running the
method on a Room object – if you are not, then you will also have to pass in the room number so you know which
room’s booked array to modify!
The setBooked method should check if the room is booked for each day between the start and end dates (inclusive) to
ensure the room is available. If the room is not available on a day the method returns false, but if the room is available
between the start and end dates then it should be set to booked for each day requested and the method should return
true to indicate success.
Bookings are not required to have booking ID values assigned to them, but you may add them if you wish as they may be
useful to later functionality.
8
Please enter check-out day:
30
*** Booking successful! ***
Would you like to [A]dd a new booking or [R]eturn to the previous menu?
A
Please enter guest ID:
2
Please enter room number:
202
Please enter number of guests:
1
Please enter check-in month:
8
Please enter check-in day:
29
Please enter check-out month:
8
Please enter check-out day:
30 101
Room is not available during that period. Please enter new room number:
*** Booking successful! ***
NetBeans does not come with the Java JDK, which must the downloaded separately from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Any good text editor would be suitable for writing the source code.
During your implementation of the program in each of the languages chosen you should make notes about the
language features which exist or do not exist, and which have therefore made program development easier or
more difficult.
Where a language has not provided a feature which would have been useful to the implementation of the
program, or where the complexity of using a language feature has been high you should remark upon it and
briefly discuss a mechanism or feature of another language which would have made development easier.
After completing the application in all languages (or as many as you can), discuss the comparative ease of
implementation in terms of the design, implementation and debugging for each programming language,
including how robustness issues were addressed.
You must supply your program source code files and language suitability report documentation in as single
compressed archive called:
ITECH5403_Assignment_2_<YOUR-NAME>_<YOUR-STUDENT-ID>.zip
You may supply your programming language suitability report in either Word or LibreOffice/OpenOffice format
in which the document can be edited – no proprietary Mac specific formats, please.
Assignments will be marked on the basis of fulfilment of the requirements and the quality of the work. In
addition to the marking criteria, marks may be deducted for failure to comply with the assignment
requirements, including (but not limited to):
Submit your assignment (all program source files plus your discussion document) to the Assignment 2 Upload
location on Moodle before the deadline of Friday of week 11 at 5pm.
The mark distribution for this assignment is explained on the next page.
Assignment 2 – Parallel Implementations
Implementation 1: Java
- Functionality,
10
- Adherence to the specification, - Robustness / input
handling.
Implementation 2: Python
- Functionality,
10
- Adherence to the specification, - Robustness / input
handling.
Implementation 3: Lisp
- Functionality, 10
- Adherence to the specification, - Robustness / input
handling.
Comments: