ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 1 of 10 ITECH5403 - Assignment 2 – Parallel Implementations Due...

1 answer below »
Please refer to rubrics and must be APA referencing


ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 1 of 10 ITECH5403 - Assignment 2 – Parallel Implementations Due Date: 5pm, Friday of Week 11 This assignment will test your skills in programming applications to specification in a number of different programming languages, and is worth 20% of your non-invigilated (type A) marks for this course. Assignment Overview 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: - The features of the languages used, - Which features you found useful, and - Any issues or complications which arose due to the complexity or lack of any language features. 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.) Add a guest 2.) Add a room 3.) Add a booking 4.) View bookings 5.) Quit The functionality of these options is as follows: ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 2 of 10 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. To successfully create a room booking: • The guest ID must be a guest which is registered on the system, • The room number must be of a room that exists, • 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 • The room must be available on the dates requested. 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: - The guest’s name, - Which room number they booked & number of guests staying, and - The check-in and check-out dates. 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: - The guest’s name, - The number of guests staying, and - The check-in and check-out dates. 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. ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 3 of 10 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. Room Booking Dates 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: - int dateToDayNumber(int month, int day), - int dayNumberToMonth(int dayNumber), - int dayNumberToDayOfMonth(int dayNumber), and - bool setBooked(int startDayNumber, int endDayNumber). 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. ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information Technology CRICOS Provider No. 00103D Page 4 of 10 int dateToDayNumber(int month, int day) { // Catch invalid input and return early if (month < 1="" ||="" month=""> 12 || day < 1="" ||="" day=""> 31) return 0; if (month == 1 ) return day; if (month == 2 ) return 31 + day; if (month == 3 ) return 59 + day; if (month == 4 ) return 90 + day; if (month == 5 ) return 120 + day; if (month == 6 ) return 151 + day; if (month == 7 ) return 181 + day; if (month == 8 ) return 212 + day; if (month == 9 ) return 243 + day; if (month == 10) return 273 + day; if (month == 11) return 304 + day; return 334 + day; } int dayNumberToMonth(int dayNumber) { // Catch invalid input and return early if (dayNumber < 1="" ||="" daynumber=""> 365) return 0; if (dayNumber <= 31="" )="" return="" 1;="" jan="" if="" (daynumber=""><= 59="" )="" return="" 2;="" feb="" if="" (daynumber=""><= 90="" )="" return="" 3;="" mar="" if="" (daynumber=""><= 120)="" return="" 4;="" apr="" if="" (daynumber=""><= 151)="" return="" 5;="" may="" if="" (daynumber=""><= 181)="" return="" 6;="" jun="" if="" (daynumber=""><= 212)="" return="" 7;="" jul="" if="" (daynumber=""><= 243)="" return="" 8;="" aug="" if="" (daynumber=""><= 273)="" return="" 9;="" sep="" if="" (daynumber=""><= 304)="" return="" 10;="" oct="" if="" (daynumber=""><= 334)="" return="" 11;="" nov="" return="" 12;="" dec="" }="" int="" daynumbertodayofmonth(int="" daynumber)="" {="" catch="" invalid="" input="" and="" return="" early="" if="" (daynumber="">< 1="" ||="" daynumber=""> 365) return 0; if (dayNumber <= 31="" )="" return="" daynumber;="" jan="" if="" (daynumber=""><= 59="" )="" return="" daynumber="" -="" 31;="" feb="" if="" (daynumber=""><= 90="" )="" return="" daynumber="" -="" 59;="" mar="" if="" (daynumber=""><= 120)="" return="" daynumber="" -="" 90;="" apr="" if="" (daynumber=""><= 151)="" return="" daynumber="" -="" 120;="" may="" if="" (daynumber=""><= 181)="" return="" daynumber="" -="" 151;="" jun="" if="" (daynumber=""><= 212)="" return="" daynumber="" -="" 181;="" jul="" if="" (daynumber=""><= 243)="" return="" daynumber="" -="" 212;="" aug="" if="" (daynumber=""><= 273) return daynumber - 243; // 273)="" return="" daynumber="" -="" 243;="">
Answered Same DaySep 13, 2021

Answer To: ITECH5403 – Comparative Programming Languages School of Science, Engineering and Information...

Yogesh answered on Sep 20 2021
139 Votes
Report.doc
Comparison between Python, Java and Lisp:
Python: Python is widely used for Artificial intelligence, developer, and is very recent in trending.
Java: Java is widely used for GUI development; Java is static which provides security to program.
Lisp: Lisp had previously grown standard in Artificial intelligence and has a unique macro system which implements intellig
ence.
        Python
        Java
        Lisp
        Python is simple and having shorter code and hence Python is easy to use.
        Due to larger and complex coding then Python, productivity is less.
        The coding is complex as like Java and productivity is less.
        Interpreter convert the Python source code into the machine code line by line.
        Compiler convert JAVA source code into an intermediate code called bytecodes.
        Compiler convert the lisp source code into intermediate called code called a byte code.
        Interpreter translates one statement of program at a time.
        Compiler scan the complete program and converts it into the machine code.
        Compiler scans the complete program and convert it into the machine code.
        The debugging in easy as the program stops whenever first error is met.
        The compilation is hard as the program stops after whole scanning.
        The compilation is hard as the program stops after whole scanning.
        The number of implementations in Python is one main and branches for example Jython and stack less.
        The Java implements, creating the program, compiling of program and running the program.
        There are several numbers of implementations in lisp for example lists.
        The commands in python codecs.open(), open(), io.open(), sys.stdin(), is.pathsep, etc.
        The commands in Java are copy command, paste command, cut command, command history, etc.
        The commands in lisp are car, cdr, list, first, print list, Prin1, Princ, cons, etc.
Python is much slower in performance and speed of execution as Python use cython to compile Python code into C, C++ code
Python as well as Java are having robust libraries and frameworks. But Java has a robust ecosystem for Software development.
Java/A-2.iml









Java/out/production/A-2/com/company/Hotel.class
package com.company;
public abstract synchronized class Hotel {
public static String[] creds1;
public static Integer[][] creds2;
public static Integer[][] creds3;
public static int month;
public static int day;
public static int daynumber;
public static int gidbook;
public static int rnobook;
public static int nogbook;
public static int inmonth;
public static int inday;
public static int outmonth;
public static int outday;
public static int indn;
public static int outdn;
public static int vgid;
public static int vrno;
public void Hotel();
public static void main(String[]);
public static void main1();
private static void setinitialdata();
public static void start();
public static void addguest();
public static void addroom();
public static int datetodaynumber(int, int);
public static int daynumbertomonth(int);
public static int daynumbertodayofmonth(int);
public static void findguest();
public static void findroom();
public static void monthin();
public static void dayin();
public static void monthout();
public static void dayout();
public static void checkdates();
public static void changeroom();
public static void setbook();
public static void findguestbooking();
public static void viewguestbookings();
public static void findroombookings();
public static void viewroombookings();
public static void views();
public static void endprog();
static void...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here