Creating a text-based program for storing data

Assignment Help Programming Languages
Reference no: EM131660691

Assignment - Parallel Implementations

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 or Perl (you may choose either of these).

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:

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.

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.


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; // Sep
if (dayNumber <= 304) return dayNumber - 273; // Oct
if (dayNumber <= 334) return dayNumber - 304; // Nov
return dayNumber - 334; // Dec
}

Verified Expert

This assignment involves writing code in three languages like Java, python and perl. The application involves writing code that manages the room booking of the customers. The application contains the option to Add a guest, Add a room, Add a booking, and View bookings. The application is implement in all the languages and tested and output of each of the program is attached with the documentation

Reference no: EM131660691

Questions Cloud

Most advanced economies in the western hemisphere : Would the establishment of a Free Trade Area of the Americas agreement be good for the two most advanced economies in the Western hemisphere,
What were the consequences of a failure to report : What impact did his decision have on patient safety, on the risk for litigation, on the organization's quality metrics
8500 is deposited into an account paying : 8500 is deposited into an account paying 8% annually, to provide four annual equal amount withdraws beginning in one year
What is the main purpose of the risk management plan : What is the main purpose of the risk management plan? How should the document be constructed?
Creating a text-based program for storing data : ITECH5403 - ssues or complications which arose due to the complexity or lack of any language features and implement the application in each language
Describe limited liability entity of a business : Although a limited liability entity may be the best organizational form for most businesses, a significant number of firms may be better off as a corporation.
What will be the approximate population of the country : What will be the approximate population of the Country, if its current population of 250 million grows at a compound rate of 2.5% annually for 20 years?
Analyze the levels of data measurement : Analyze the levels of data measurement. Provide at least two business research questions, or problem situations, in which statistics was used or could be used.
What does it mean to allocate the cost : What does it mean to allocate the cost of an asset over its useful life?

Reviews

inf1660691

12/29/2017 4:12:25 AM

Thanks you so much, really satisfied with the solution, just moving around rather focus on answering the real problem.. Focused answers what is being asked. I am really satisfied as you paid attention about requirements. You did follow the mentioned everything. Thanks a lot...

len1660691

9/27/2017 5:50:38 AM

Documentation and discussion of the comparative ease of implementation (design / implement / debug) in each programming language, including how robustness issues were addressed. 10 Spelling and grammar 5 Assignment mark total / 45 Contribution to unit mark (out of 20%) %

len1660691

9/27/2017 5:49:31 AM

including (but not limited to): • Incomplete implementation(s), and • Incomplete submissions (e.g. missing files), and • Poor spelling and grammar. 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.

len1660691

9/27/2017 5:49:20 AM

You must supply your program source code files and language suitability report documentation 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

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd