COIT11134 Object Oriented Programming (T1 2019) Assignment Item 1 – GUI and Inheritance
• Gain an understanding of Object-Oriented Programming (OOP) concepts in Java such as Inheritance, Aggregation and/or Polymorphism.
• Obtain practical skills in Graphical User Interface (GUI) programming by implementing an event-driven application using Java Swing library components. • Develop and test stand-alone Java applications.
Assignment Details (Version 1.1 last updated on 14/03/2019)
Friendly Student Accommodation (FSA) is a real estate agent that rents individual rooms and whole properties to students. They manage various types of rental properties, ranging from wooden houses to apartment units in city skyrises. You have been hired by FSA to develop a Java GUI application to help manage their business.
This proposed software will allow FSA staff to enter the details of newly acquired rental properties into the application. FSA staff will be able to manage these rental properties, such as changing their rental prices, the inclusions that come with these rental properties, and so on. The application will also create periodic backups of the properties stored within.
There are 2 categories of rentals that FSA manages.
1. Room Rental
a. These are rooms inside whole properties that are rented to individual students.
b. For example, a house has 5 rooms within and they can be rented to 5 different students separately.
2. Whole Rental
a. These are rental properties that are rented as a whole to a student.
Develop a Java GUI application using Swing components to implement the application.
You are allowed to work on this assignment by yourself or in
The functional requirement for the proposed application are:
Phase 1 (Assignment 1)
1. Enter 1 rental property into the application
2. Edit and update the details of this rental property
3. Display a list of previously entered rental properties in the system (should only display the 1 entered earlier)
4. Exit the software safely
Phase 2 (Assignment 2)
1. Enter the more than 1 rental property into the application
2. Retrieve the details of rental properties previously entered
3. Edit and update the details of rental properties previously entered
4. Deleting rental properties from the application
5. Display a list of available rental properties in the system
6. Output the list of available rental properties into a file
7. Exit the software safely
Assignment 1 Tasks
For Assignment 1, you only need to enter 1 rental property into the application.
1. Designing your classes
Each rental property entered has to be either Individual rooms or Whole properties. More categories might be introduced in future but that is outside the scope of this project.
The attributes required for the 2 rental property types are shown in the table below.
Room Rental Whole Rental
Rental ID Rental ID
Weekly price Weekly price
Couples allowed Number of rooms
Attached bathroom Number of bathrooms
When developing Java classes for these 2, consider how the common attributes above
might affect your design using Inheritance and/or Polymorphism.
HINT: An abstract super class Rental is needed to bring these 2 together.
The table below provides information about the attributes needed in your rental properties.
Attribute Data type & Comment
Rental ID Auto-generated
Room: R followed by 4 digits. Eg R1254
Whole: W followed by 4 digits. Eg. W0001
Weekly price Currency
Couples allowed True/False
Attached bathroom True/False
Number of rooms Whole number
Number of bathrooms Whole number
Garage space True/False
Pets allowed True/False
2. Designing your GUI
You are to design your own GUIs but please take note of the following:
- When designing and developing your GUI, keep in mind how a user might enter the details for rental properties.
- There is a list of functions needed for this application. i.e. entering details, editing details, displaying list of properties, etc.
With this in mind, consider designing a “default” landing screen that has options (buttons/menu items/tabs) for the user to bring up the other screens developed for the various functions of your application.
- How can the user select which rental property type to enter?
o Allow the user to select which of the 2 types of rental property they want to enter and bring up the relevant input screen (different input screens)
o OR Allow the user to select which of the 2 types of rental property they want to enter and enable/disable the respective input fields on the input screen (single input screen)
o OR Create your own design. Check with your local tutor whether your design is acceptable or not.
- Editing the details of the previously entered rental property o There are many ways to implement this. o You can reuse the original input screen add an [Update] button. To update, you populate the fields from the data in your object. When the [Update] button is clicked, your application can overwrite all the old values with the new. o OR You can use a totally new and separate input screen for editing. o OR Create your own design. Check with your local tutor whether your design is acceptable or not.
o Do not forget to re-validate inputs when updating.
- When displaying the list of previously entered rental properties, you need to display for each property: o Rental ID
o Rental type (Room or Whole)
o Address o Weekly price o Furnished o Description o Couples allowed (when relevant) o Attached bathroom (when relevant) o Number of rooms (when relevant) o Number of bathrooms (when relevant) o Garage space (when relevant)
o Pets allowed (when relevant)
- JFrames should be used and can be designed graphically (drag and drop using NetBeans) or manually using Textpad or similar.
Bonus marks will be given if your GUI was built manually using Layout Managers, since
more effort and learning is involved. (See marking guide)
3. Implementation requirements
- You must create an object(s) (based on your design in “Designing your classes”) to store the details of your rental property. Simply saving the entered values into variables in your application will not give you any marks.
- Polymorphism in your code o Assignment 1
? You must use a variable of the Rental class to reference the object that will store the details of the rental property.
? The object created will be dependent on the type of rental property selected. i.e. if the user selected “Room Rental”, then a RoomRental object should be created instead of a WholeRental object.
? You will also use this reference variable when updating and displaying the rental property. o Assignment 2
? You will need to use a Dynamic Data Structure (ArrayList or LinkedList) of Rental objects to store all the rental properties.
- After successfully entering the details of a rental property, the GUI should be reset and ready for another entry.
- The following must be disabled until after at least 1 rental property has been entered.
You can either disable the section completely or display an error message to the user. o Function to edit the previously entered rental properties o Function to display the list of previously entered rental properties
- When exiting the application, a dialog must appear to confirm whether the user really wants to exit.
- Your code must be commented sufficiently.
Areas to note are: o Comment headers at the top of each class that includes the name of the class, the purpose of the class, student name, student id
o All methods should have a method headers that describe what the method is trying to do
o Instance variables: what they are to be used for o Decision structures: what will happen for each decision path o Loop structure:
? what happens during each iteration of the loop
? when will the loop end o Other code sections that need additional explanation should include comments as well.
- Variable/method names should be meaningful. Camel notation should be used as well.
- Constants should be used when appropriate. i.e. literal Strings or numbers
- Currency must be stored as a double and must always be displayed to 2 decimal places.
4. Validation requirements
- Input values have to be of the correct data types. Some of these can already be validated automatically depending on the type of GUI component you chose in your GUI design.
- Rental ID – Must start with “R” or “W” and followed by 4 numbers.
- All values must be entered/selected before a new rental property can be saved into your application. Error messages should be shown if something is missing.
- All values must be validated again when editing and updating existing rental properties.
5. Assignment Report
You will need to write a report that includes the following:
- Cover page that shows the unit code and name, assignment number, your name and student ID number
- “Screen Shots” section o Includes screen shots of your running application.
o All relevant screens, error messages, and dialogs should be included.
o Each screenshot should have a description (caption) of the respective screenshot written below.
- “Reflection” section o In this section, you need to write about the following (paragraphs or in a list)
o What difficulties did you encounter while working on this assignment? Eg. Learning how to use NetBeans, not enough time, etc
o If you were able to complete all the required tasks ? What do you think contributed to your success? ? Is there anything you can do better in future?
o If you were not able to complete all the required tasks
? Which sections were you not able to complete?
? What reasons do you think prevented you from completing them? ? How can you avoid these in reasons in future?
- “Task Breakdown” section (only needed if assignment was done in a pair) o Use a table or a list to show how you distributed the work among yourselves
- Name this report “ReportAssign1.docx”
The assignment must be submitted in the following form:
- A zip file containing all the Java source code files. If done using NetBeans, a zip of the entire project folder.
(a word file containing a cover page, screen shots showing various inputs, error messages and outputs from your application program when it is run).
- If assignment is completed as a pair, both students must submit the same files.
7. Assignment 1 - Marking criteria