Answered You can hire a professional tutor to get the answer.

QUESTION

To do this your program will need to read data from the keyboard and from certain text files in secondary storage, store the data in appropriate data...

To do this your program will need to read data from the keyboard and from certain text files in secondary storage, store the data in appropriate data structures using objects, sort the data, and write output data to both the screen and to secondary storage. The specific functional

3

requirements are described in section B(2). The text files that are to be used for this programming project are described in section B(3). The classes that must be used as a minimum are described in section B(4).

B 2. Program Requirements / Functionality

The Java program must

a) Be object-oriented utilising the classes described in section B (4) as a minimum. Other classes may also be needed to solve the program requirements.

b) Be menu-driven. The main menu must have the following menu items:

1. Reservations Management

2. Room Management

3. Save Data

4. Exit from Program

c) Be able to process the defined text files. The text files and their formats are described in section B (3).

Program Start Up

When the java program starts it must perform the following file related operations:

d) Read the data from the roomList.txt file into computer memory into an appropriate array of objects (see section B (3) for a description of the roomList text file and section B (4) for a description of the Room class).

e) Read the data from the reservationList.txt file into computer memory into an appropriate array of objects (see section B (3) for a description of the reservation list text file and section B (4) for a description of the Reservation class).

After processing these files the program should display the main menu identified in section B(2)(b) above.

Main Menu Item Functionality

The required functionality for each menu item is described as follows:

1. Reservation Management

When this menu option is selected the following sub-menu should be displayed.

1. New Reservation

2. Update Existing Reservation

3. Delete a Reservation

4. Exit to Main Menu

New Reservation

When this option is selected, the program should ask the user to enter data for each field of a reservation required by the Reservation class. Reserving a room should comply with the validation rules explained in section B(5).

Update Existing Reservation

When this option is selected, the program should ask the user to enter the reservation ID. The program should then show the reservation details against that reservation ID and should ask the user to enter updated information for all fields of a reservation.

4

Delete a Reservation

Upon selection of this menu item the program should ask for the reservation id. The program should check the reservation list and display the details of that reservation on screen. The program should ask the user for confirmation ("Are you sure you want to delete this reservation Y/N"). If the user chooses Y, the program should delete the reservation and should update the reservation list accordingly. Deleting a reservation should comply with the validation rules specified in section B (5).

Exit to Main Menu

Selecting this option should take the user back to the main menu (Section B (2) b).

2. Room Management

Selecting this option should display a list of options described as below.

1. Adding a New Room

2. Update Room Information

3. Delete a Room

4. Exit to Main Menu

Adding a New Room

Choosing this option will ask the user to enter all the information required by the Room class (Section B (4)) to create a new room. Once a new room is created, the program should add the room into the room list. Adding a new room should comply with the validation rules specified in section B(5).

Update Room Information

Upon selection of this option, the program should ask the user for a room number that needs to be updated. The program should also validate if a room with that number exists in the list or not. The program should ask the user to enter a valid room number if the room number does not match with any room in the room list.

Once the room number is matched, the program should display the information of that room and should ask the user to enter all the information again (except the room ID) for that particular room. The program should update the room information and should update the room list accordingly.

Delete a Room

Upon selection of this option, the program should ask the user for a room number that needs to be deleted. The program should also validate if a room with that number exists in the list or not. The program should ask the user to enter a valid room number if the room number does not match with any room in the room list.

Once the room number is matched, the program should display the information of that room and should ask the user to confirm ("Are you sure you want to delete this reservation Y/N"). Once confirmed, the program should delete that room and should update the room list accordingly.

Deleting a room should comply with the validation rules specified in section B (5).

Exit to Main Menu

Selecting this option should take the user back to the main menu (Section B (2) b).

5

3. Save Data

The program must write the room list data back to the roomList.txt file and write all reservations to the reservationList.txt file.

4. Exit Program

The program must terminate when this menu item is selected. The program should not terminate until this option is chosen. At other times the program should return to display the Main menu after completing the chosen menu option.

B 3. Text Files to be processed

The data that is to be manipulated by your Java program in this programming project is contained in the text files roomList.txt, and reservationList.txt. Examples of these files are found in the zip file for this programming project. The data within these text files will need to be read into memory by your program so that it may be manipulated to solve many aspects of the required functionality of this programming project. The text files have been created to conform to a particular format. The format for each file is described below:

File: reservationList.txt

This file contains a full record of all rooms currently reserved. Each line within the file represents a reservation from the list, and has the following format:

Reservation ID, Reservation Name, Room Number, Check-In Date, Check-Out Date, Special Requirements

where each data item is separated by a comma (,).

A brief explanation of each of these data items:

Reservation ID: a unique numeric identifier for a reservation

Reservation Name: name of the person making reservation

Room Number: the room number for which the reservation has been made

Check-In Date: the starting date of a reservation

Check-Out Date: the ending date of a reservation

Special Requirements: any special requirements provided by the customer

File: roomList.txt

This file contains a full record of all rooms. Each line within the file represents a room in the hotel/motel, and has the following format:

Room Number, Capacity, Rent

where each data item is separated by a comma (,).

A brief explanation of each of these data items:

Room Number: a unique numeric identifier for a room

Capacity: number of people the room can accommodate

Rent: rent / night for the room

When reading the text files into memory the data should be read into appropriate array(s) of objects. The classes for these objects are briefly outlined in section B(4).

6

B 4. Required Classes

To write your solution for this project it is a requirement that you write appropriate code for at least the following java Classes:

a) Room

b) Reservation

These classes are described in general terms as follows:

a) Room class: the Room class represents an individual room. The Room class needs data fields for the Room Number, capacity and rent. Implement appropriate constructors, accessors, mutators and other appropriate methods for this class based upon the general requirements of the assignment specification.

b) Reservation class: the Reservation class represents a reservation that has been made by the customers and entered by the staff. The Reservation class needs data fields for the reservation ID, reservation name, room number, check-in date, check-out date, special requirements. Implement appropriate constructors, accessors, mutators and other appropriate methods for this class based upon the general requirements of the assignment specification.

Apart from the above two classes it is quite likely that you will also need to write other classes depending upon your solution method.

B 5. Validation Rules

The program should comply with the following validation rules

1. Delete a room - when a user wants to delete a room, the program should check if the room is already reserved or not. If the room is reserved, the program should display a message to user ("The room is reserved for current time, and cannot be deleted").

2. Delete a reservation - while deleting a reservation, the program should check if the date of that reservation has past or not. If the date has already past for any reservation, the program should display a message ("the reservation cannot be deleted as it has already past").

3. Add a new Room - The program should validate the room number entered by the user is not already assigned to another room. In that case the program should give an error message asking the user to enter a new room number.

4. New Reservation - The program should be able to check if the room is already reserved or not, based on the room number and dates (check-in and check-out) entered by the user. The program should also check if the reservation dates for a specific room overlaps or not (e.g. the room requested is already booked/reserved in those dates).

5. Check-in and check-out dates for a new reservation has to be entered by user in (DD/MM/YYYY) format. The program should be able to tokenise the date as a day, month or year for validation.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question