Essay Help Services

COSC1295 | Advanced Programming Assignment 2 | Programming

Home Recent Questions COSC1295 | Advanced Programming Assignment 2 | Programming

Task Specifications

Packages and Organisation of Code

You must use the following packages to separate your code into sets of related classes and interfaces:
•view: contains all your GUI classes.
• controller: contains all your listener classes which store event handling code.
• model: contains the main business logic of your application, all your classes to store and process data (Room, Standard Room, Suite...), all exception classes and all database and file handling classes. You can use sub-packages inside the packages shown above.

Data Generation
You are required to generate data for 6 rooms, including 3 standard rooms and 3 suites. At least one standard room and one suite having 2 completed rental records with random information such as customer ids, rent, return dates, rental fees and late fees that you are free to create as long as they are reasonable.

Exception Handlings
Creating Custom Exception Classes

In assignment 1, methods such as rent(...), returnRoom(...), performMaintenance(), completeMaintenance(..) have boolean as return types to indicate whether the corresponding operation is executed successfully or not. In assignment 2, you are required to modify all those methods so that all of them will return void instead of boolean and will throw custom exceptions. You are required to create custom exceptions such as RentException, ReturnException, MaintenanceException, InvalidIdException…. to represent various
exceptional cases that can occur when those methods are executed. All of those custom exception types should allow appropriate error messages to be specified when exception objects are created.

Generating and Propagating Exception Objects
To use your custom exceptions effectively, you will need to look for areas in your program where you need to handle various cases such as when there is an invalid room id, or when a room or suite cannot be rented or returned, or when there is an invalid user input… Then you should generate appropriate exceptions and throw those exceptions back to the appropriate class to be handled.

Handling Exceptions
Those various exception objects should then be allowed to propagate back to the appropriate class (i.e. those exception should not be caught locally within the class that generates the exception).

All exceptions will need to be caught and handled in an appropriate manner by displaying a dialog box via the GUI to the user, showing the error message contained within the various exception objects that have been propagated up from the relevant method call.

Using Database For Data Persistence
Every time your program is executed and terminated, data will be read from and save to a database. For this assignment, you should use an embedded HSQLDB (shown in the lecture) or SQLite database. You must keep all database files in a folder named databasewhich is a direct sub-folder of your assignment project.

You must create at least one table in your database to store all data of the CityLodge application including room and rental records. You are free to design the database, to chose appropriate tables, columns, data types that are suitable for storing data in your application.

NOTE: No need to store images directly in the database. Only image file names should be stored as text in the database. All images will still be kept in the imagesfolder which is a direct sub-folder of your assignment project.

Graphical User Interface (GUI)
All user interaction with the CityLodge system will be done via the GUI. Users should be able to click buttons, select menu items, choose list items from drop-down lists to perform all functionalities described in Assignment 1 such as add, rent and return a room as well as perform and complete room maintenance.

Main Program Window

• This is the first window a user will see when running your program.
• This window should contain a menu bar from which users can execute the main functionalities of your program, such as adding a new room, import room data from text file, export room data to text file, quit the program and other main functionalities described below. When a button is clicked or a menu item is selected, new windows or dialog boxes should be displayed to allow users to perform corresponding functionalities.
• The centre area of this window will contain a scrollable list of standard rooms and suites managed by your program. Each list item displays information about a rental room using various JavaFX User Interface Controls such as ImageView, Label, Buttons…, rather than just a text area showing the output of getDetails() method.
â—‹ In this list, each list item provides an overview of a room with an image of that room, room type, status, features... and a button that users can click on to go to the detail view of that room to perform more functionalities related to that room (more details are in the Room Detail Window section shown below)

Room Detail Window
• When the user selects a standard room or a suite in the room list shown in the Main Program Window, your program must display this Room Details Window to allow the user to see all details of the selected room, including a larger image of that room.
•This window must have a scrollable list to display complete rental records of that room.0
• This window must have buttons which allow users to perform various activities related to this room such as rent, return, maintenance and complete maintenance.
• Users should be provided with a way to return to the Main Program Window from this Detail Window

Other GUI Requirements
•You are encouraged to explore and use various JavaFX User Interface (UI) controls to implement your graphical interfaces for functionalities such as add room, return room, maintenance and complete maintenance. Some suggestions for such UI controls are the Dialog class and its subclasses such as TextInputDialog, ChoiceDialog and Alert classes in the javafx.scene.control package.
• All user inputs via the GUI must be validated.
• All error messages and messages from Exception objects should be displayed in the GUI using JavaFX Alert classes in the javafx.scene.control package. Do not output any error message to the Console.
• Important functionalities such as Save to Database, Import, Export, Quit should always be available in the main menu bar of your program.

Using Text Files for Exporting and Importing Data
Your CityLodge GUI program must contain Export Data and Import Data menu items in the main menu bar to allow users to:
•export all room data of your program and corresponding rental records to a single text file.
• import all room data and corresponding rental records from a given text file.

When the user selects the Export Data menu item, your program should export all data to a single text file named export_data.txt, which will be saved in a folder chosen by the user. (Hint: this feature can be implemented in your GUI program by using the DirectoryChooser class in the javafx.stage package).

When the user selects the Import Data menu item, your GUI program must display a FileChooser window (hint: FileChooser class is located in the javafx.stage package) to allow the user to select a text file also in the format as shown above. Your program must be able to read rooms and rental record data from that text file. If a room has no corresponding image, a default image with the phrase "No Image Available" should be used.
 
NOTE: You don't need to export images. All images will still be kept in the imagesfolder in your assignment project. Only image file names should be exported as shown in the format shown above.

Similar Posts

Order Now

Latest Reviews

Facebook

Payments And Security