Recent Question/Assignment

COIT20256 Assignment 2 Specification
Due date: Thursday of Week 11 (30th May 2019) 11.45 pm AEST
Weighting: 30%
Length: NA 2
1. Objectives
The purpose of this assessment item is to assess your skills attributable to the following learning outcomes and achieving the expected graduate attributes of advanced level knowledge, cognitive, technical, and creative skills, and self-management.
• Compare and contrast different algorithms in problem solving
• Design and implement appropriate data structures for application development
• Evaluate a variety of data structures and algorithmic approaches including: recursion, linked lists, stacks, queues, streams, search trees, sorting and searching
• Analyse, develop and implement software solutions with the focus of data structures and algorithms
• Apply classes, inheritance, polymorphism, and exception handling
• Programmatically connect to a database and implement the database operations
• Work collaboratively as part of a small team
• Demonstrate socially innovative practices in software development
2. Assessment task – Paired Programming
Your task in this assessment is to analyse the given problem, model, and design the required data structures using UML class diagrams. You will be implementing the software solution, applying efficient algorithms, inheritance, polymorphism, database programming, and exception handling. You will be using a variety of data structures and algorithms in your solution design. The topics required for this assessment task are from Weeks 1-10. Your Java Application should have an interactive Graphical User Interface (GUI) based on the JFrame class using SWING GUI components. Your application will connect to a database programmatically, executing necessary SQL queries within your java program.
You should also write an individual report, as specified in this document, demonstrating your conceptual knowledge and communication skills.
2.1 Problem
This is an extension to the problem given in Assessment Item 1 as specified here. Hotels are the heart of tourism industry in any nation. Hotels are booked using a software application with an easy to use, and intuitive user interface. NEXT hotel is a major hotel business group and they have a hotel in Brisbane. The IT manager of the Brisbane operation has kindly agreed to support a project to develop a prototype for a new Hotel Booking System (HBS) which will be further developed into a webservice. The support for the full development of the system depends on the quality of the prototype.
COIT20256 Data Structures and Algorithms Term 1 2019 The initial prototype you have designed for the HBS has very limited functionality of enabling a user to enter customer details, booking details, and save the data to a file. In this Assignment, you have to extend the prototype developed as part of your first Assessment to a functional application that can be released as a beta version for initial testing
The application developed as part of your first Assignment has created a datafile named ‘bookingData.csv’ The file has the customer details and booking detailed saved as a list of comma separated values. Include in this file a list of ten (10) to fifteen (15) bookings.
The HBS should have the following functionality
1. Load the data from the .csv file and save the list to a database (only for the first time).
2. Load the data from the database to a Linked List
3. Save new bookings into the database
4. Display the sorted checkout date and Customer names (sorted by last name) in two ListBoxes.
5. Display the complete booking details of the selected items in the TextArea.
If the User chooses one or more check out dates from the ListBox, or one or more customer names, display the booking details for those
2.2 Design Guidelines
You can use the following guidelines in your modelling and GUI design.
Graphical User Interface
The application should have a GUI for user interactions. This GUI should have the necessary components to enable the user to execute all the functions as provided in Section 2.1 above. You may use the guidelines provided below for your GUI design and implementation. Variations to the provided guidelines are acceptable as long as it meets the user requirements.
i) Input Panel
The top panel can have Labels to display attribute names and TextFields to enable the user to enter the attribute values for the Customer and Booking classes. Use RadioButtons for user to select between Domestic Customer and International Customer. Once the user chooses one of the options, the required Labels and TextFields should be displayed for entering data. Use a ComboBox to display and choose the Room types. Include two ListBoxes for displaying the check out dates and Customer names. You may arrange Labels and TextFields in horizontal or vertical alignments.
ii) Display Panel
This panel can have a TextArea to display welcome message to the User and other messages during the program execution. Once the user clicks the ‘Save Data’ Button, display the saved Booking details. iii) Button Panel
This Panel can have a label “Command Buttons” and can contain the required Command Buttons of ‘Enter Data’, ‘Save Data’, ‘Display Choices’, ‘Clear Display’ and ‘Quit’.
A full GUI design diagram is not given to encourage you to design a user friendly interface.
Display a welcome message when the program starts.
Hello Mary Welcome to the Hotel Booking System
Enter the details of the booking including the details of the person responsible for the booking in the given spaces and click the ‘Enter Data’ button. Domestic customer’s driver’s licence number, and expiry date should be entered. An internal customer’s passport number and expiry date should be entered.
Use ctl+click to select multiple items from the displayed List of check out dates or Customer names.
Use the Display Choices button to view details of your choices Use the Save button to save the entered bookings.
Your application should start by loading the data from the data file and saving the data to a database only for the first time. If the database exists and contains records, then the program need not load data from the file. Rather, the application should load the data from the database.
Enter Data Button
The user enters the Domestic or International Customer details and the Booking details and clicks the ‘Enter Data Button’.
You should validate the check in and check out entries so that:
a) the check-out date should be later than the check in date.
b) both the dates should be later than the current date. (assuming bookings are done and confirmed at least 12 hours prior to check in.)
If there are errors, appropriate error message should be displayed.
All the TextFields should be completed. Display appropriate error messages if the user hasn’t entered value in any of the TextFields.
If entries are correct display a message informing booking confirmation. The Booing and Customer details should be added to a LinkedList of Booking.
An example display is shown below. You can design and choose your own wordings for the message to make it user friendly.
Hello Michael Thank you for using the NEXT HBS Your booking as shown below is confirmed.
Mr Michael Martin,, 0453234234, T12345, 07/2020,
Check in 05-03-2019, Check out 08-03-2019 Guests 2, SUPERIOR_QUEEN, $250 per night
Display Choices Button
The user clicks this button to view the booking details of the chosen customer/s or check out date/s using the ListBoxes. Display appropriate error messages if the user clicks this button before choosing items.
An example display is shown below for two selected check out dates.
Mr Michael Martin,, 0453234234, T12345, 07/2020,
Check in 05-03-2019, Check out 08-03-2019 Guests 2, SUPERIOR_QUEEN, $250 per night
Dr Chen Li,, +12025345678, M328758, 05/2023
Check in 04-03-2019, Check out 09-03-2019 Guests 2, Breakfast_Queen, $270 per night
Save Button
Clicking this button should save the new bookings from the LinkedList to the database.
Clear Display Button
Clicking on the “Clear Display” button should clear all contents from the TextArea, and the TextFields.
The “Quit” button should allow the user to exit from the application. Data Structures
You may follow the class designs given below. You should read the specification carefully and design the classes using UML class diagrams and include the attributes with correct data types and all the methods, clearly indicating public or private. Clarify your doubts during the design stage so that your implementation can be less error prone and faster to complete.
You can use classes from your own Assignment One solution or from Assignment One solution provided on the Unit website. But you should understand the code and make necessary changes.
i) Customer class (same as Assignment One)
This is a generic class and has the attributes: title
first name last name email address phone
This class should have:
a parameterised constructor, accessor, mutator methods, and a toString() method. ii) DomesticCustomer class (same as Assignment One)
This class extends the Customer class.
In addition to the inherited attributes, this class has:
Driver License Number
Expiry Date
This class should have a parameterised constructor, copy constructor, a default constructor, accessor, mutator methods, and a toString() method.
iii) InternationalCustomer class (same as Assignment One) This class extends the Customer class.
In addition to the inherited attributes, this class has:
Passport Number
Expiry Date
This class should have a parameterised constructor, copy constructor, a default constructor, accessor, mutator methods, and a toString() method.
Hints and tips: Refer to Week 3 Lecture and tutorial solutions, and the Textbook chapter on Polymorphism for the correct implementation of polymorphic behaviour.
iv) Booking class
This class has the attributes:
Check in
Check out
Number of guests
Room type
Room rate
v) DatabaseUtility class
This class is for saving and reading data from the ‘HotelBooking’ database. This database should store records of bookings and customers.
This class should have the following attributes. Databse url name sqlConnection username password bookingList to store and return the booking details data.
This class should have a constructor to set values to the attributes and connect to the database.
A method to create the Database tables executing the sql queries.
Method to insert the Customer Data
Method to insert all the Booking data.
Method to read data from the database and return the Booking details
You should use PreparedStatements in the above methods to insert values into the database or read values from the database.
i) DataFile class (modified from Assignment One)
This class will have a parameterised constructor that takes the filename to be created.
Include a method to write data to a file named ‘bookingData.csv’ using the values from ArrayList of Bookings.
Use necessary file handing exceptions.
In addition to the above methods already implemented as part of Assignment One include a method to read data from the file and load it a LinkedList of Bookings. vi) BookingGUI class
This class should have all the GUI components as described under the Graphical User Interface Design section. This class:
1. has the main method and starts the application
2. initialize the GUI components
3. stores the user entered values in temporary variables, and creates necessary objects
4. stores the data file name and creates the DataFile object
5. invokes the DataFile class method to read the objects from the DataFile
6. creates a DatabaseUtility object, and invokes methods to save records to the database and read records from the database.
Hints and tips: Refer to Week 3 Lecture and tutorial solutions, and the Textbook chapter on Polymorphism for the correct implementation of polymorphic behaviour.
You can use the following guidelines to design your database tables. Tables
1. customer: to store the customerId, title, first name, last name, email address, phone, and Passport/Licence number, country, expiry date
2. booking: to store the bookingId, customerId, check in date, check out date, number of guests, room type, room rate. (one customer can make more than one bookings).
Note: The primary keys are generated during the programmatic creation of the tables and used for other database operations. The primary keys can be auto-incremented integer values. Create an ERD to understand the relationship between tables.
You can use a Sql query to initialize the auto-incremented primary key value to a specific number.
Execute the query as shown below after executing the query to create Table.
3. Coding
Include necessary accessor, mutator methods, constructors, and toString() method for each class. Also, follow good coding practices, using meaningful names, camel case notation for naming, constants as necessary, and include meaningful comments. You can use NetBeans or another IDE to develop your application. Follow the coding standards given in the Unit website.
3.1 Paired Programming:
You can work in pairs to complete the coding. You can share the coding tasks, merge and compile the source code. You can choose your partner yourself. You should ensure that you inform your tutor about the partner. If you have any problem with choosing a partner, please inform your tutor. Distance students also can work in pairs. If there are any problems please contact the Unit Coordinator. 4. Report
Each one of you should submit a report containing the following details. This should be completed independently, not as a team.
1. UML class diagrams for the classes
2. Test plan showing input data, expected results, and actual results
3. Write your suggestions on future modifications to the HBS so that User can use it to enter review on Guests behaviour so that any guests who have followed unhealthy practices such as smoking inside the room, or have been unfriendly or noisy causing disturbance to others can be quickly identified in case of future booking requests. This can be done by suggesting modifications to the GUI or program functionality. You need not implement any additional features, but only write about possible features including changes to the GUI design.
5. Assignment Submission
You should submit the following source code files and word document using the Assignment 2 submission link available from the Unit website. (Note: the file names/class names could be changed to meaningful names). Please do not zip the whole project folder and submit it.
Submit only one set of source code files per team.
• – Source code for the Customer class
•– Source code for the DomesticCustomer class
• – Source code for the InternationalCustomer class
• – Source code for DatabaseUtility class
• – Source code for the BookingGUI class
• – Source code for the DataFile class
• Report.doc – Your word document containing the report.
The application program should create the database and necessary tables. So there is no need to submit any database files. Only one submission per pair is required.
5.1 Individual Submission
Report: The document file containing the report should be submitted individually.
Assessment Item 2 Marking criteria
S.No Total Marks - 30 Marks
Allocated Marks Scored
1 Graphical User Interface Presentation 2
2 Design and use of appropriate data structures and UML class diagrams 2
3 Design and implementation of DatabaseUtility class enabling correct creation of database and access 2
4 Efficient program design and implementation avoiding redundant code, correct use of searching and sorting methods and other library methods as required. 3
5 Programmatic creation of tables and use of prepared statements. 3
6 Use of exception handling (use appropriate exception classes and informative messages) 2
7 “Enter Data” button function 1
7 “Display Choices” button function 2
9 Save button function 3
10 “Clear Display” button function 2
11 Quit” button function 1
12 Good coding practices including comments, indentation, use of constants as required, use of meaningful names, and camelCase notation for names, following coding standards given on the Unit Website 3
13 Individual Report: Well presented report with student details, correct UML class diagrams, views on extending the system to include the customer behaviour 4
14 Penalties
15 Late Penalty (-1.5 marks (5% of total allocated marks) per calendar day)
16 Source code found entirely different from the styles followed in the Unit or containing constructs outside of this Unit will be penalised (-1 to -10 marks depending on the amount of source code)
17 Plagiarism (penalty as per the plagiarism policy)
18 Total 30