Assignment 2
Semester 2, 2014
Assignment Overview:
This assignment requires you to complete various tasks involving classes that are provided to you as a basic structure for building upon. You may also use classes that you find in the SDK. You will write your own class(es) that will create a GUI using the swing library. The focus of Assignment 2, is your development of a GUI using java swing packages, which is why you are being provided with some classes already written.
You will be required to develop your application using Java in the Eclipse environment. You will need to zip the whole project up when you are finished and submit it on Moodle by the due date. You will also need to submit a report (both electronically in Moodle and as a hard copy (consult your tutor to see if hardcopy is required)). The report will require some written and diagrammatic information describing your system as well as addressing documentation, design and testing requirements which will be outlined in the various tasks. Please write clearly and IN YOUR OWN WORDS (plagiarism is NOT acceptable – refer to Course Description). It is expected that no submissions will be identical, so ensure that your GUI has some unique elements to it. Be creative!
It is expected that each student will creatively design and author a unique system based on individual choices that fit with the requirements listed in each task. Before you begin, read over the entire assignment and understand all the tasks. You are to make use of the provided code files, but must additionally write your own classes. Acknowledge all code that you do not write yourself (but include in the classes you add), with in-code comments.
All code must conform to stylistic standards including proper commenting, appropriate choice of identifier names, proper indenting and other readability issues. Otherwise, marks will be deducted. Consult http://www.oracle.com/technetwork/java/codeconventions-150003.pdf
Your tutor may require you to demonstrate your GUI during a lab class in week 11.
Contextual/Background Information:
For this assignment, you will create a Graphical User Interface that provides the user with access to the functionality of a Real Estate Management System. Such a system would typically be used by a Real Estate Agency to help manage the details of its clients, which include both landlords and tenants. This section of the Assignment explains the roles of these clients, and the behaviour that the system should allow.
When a property owner has a house/property that they wish to make available to other people to possibly live in, they will typically go to a Real Estate Agency to enlist their services. The services include helping to find a suitable person/family to be tenants who will pay rent for the privilege of living in the house. Other services of the agency include collecting the rent, and managing other legal obligations regarding the property.
The agency will first advertise the availability of properties to the general public. Interested people can request to look at the property, and then if they like a property, they can submit an application to rent the property. Once approved by the landlord, the interested person signs a lease, which is a formal contract to commit to paying the weekly rate of rent to the agency, for use of the property. The tenant must pay for whole weeks at a time, but can make payments in advance.
Sometimes during a lease period, there may be some need for maintenance/repairs to be done on properties, in which case, the Agency will arrange the maintenance to be done but then deduct the cost from the next monthly payment to the landlord. For example, maybe the children were not playing carefully and smashed a window – requiring it to be replaced. Or maybe the hot-water service stops working and needs to be replaced.
(You can assume that the total cost of all repairs is always below the total rent collected).
Provided Files:
You are being provided with a few code files which contain the basic essence of the data management aspects of the system, but need to write classes to provide a graphical user interface. The following is a description of the provided classes:
• The RealEstateAgency class is intended to be the central place to go in the system for finding a landlord that the system -knows- about. There are methods to add a new landlord, and to find an existing landlord or to get an ArrayList of all the currently known landlords.
• The Landlord class allows you to create objects that encapsulate the key data about each Landlord, as well as the information about all the properties that they make available for rent (some of which may have current leases active). There are methods to associate additional properties with a landlord, as well as to get an Iterator that allows you to cycle over all properties owned by the landlord.
• The Property class encapsulates the basic information about one property the system knows about: essentially the address of the property, and a reference to the Lease details of the property.
• The Lease class encapsulates information about an individual lease of a property by a tenant. The data stored here includes all the tenant’s details (name, phone number) as well as characteristics of the lease itself such as the duration, the weekly rent amount (which cannot change during the lease period). Each lease is for either 6 or 12 months. However, the as program allows for you to simulate the passing of time by the collection of rent, the class also keeps track of how many weeks of rent remain to be paid. It also keeps track of details about all maintenance that has happened to the property during the period of this lease. There are methods to allow you to consider a rent payment to be made, and also to add or retrieve maintenance records.
• The Maintenance class is used to represent an individual occurrence of Maintenance – and records the cost and description of the maintenance.
If you feel you need to add additional methods to any of the provided classes, you may, but need to include in your documentation an explanation of the reason for adding the new methods.
Required behaviours in the final system
The following are the behaviours (functionality) which the user should be able to accomplish by using the completed program:
1. Ability to add a new Landlord to the system
The user needs to be able to enter the details about a new landlord. This means that the program will present a screen asking for the following information about the landlord, to then store in memory:
• name of landlord
• address of landlord, so that mail and other communication can be sent by post
• phone number of landlord, in case of urgent contact
• bank account number, so that money can be paid to the landlord. The bank account number should be between 6 and 10 digits long only.
Provided that all the above information is correctly given by the user, the program should proceed to create a new Landlord that is stored in the system.
Initially, a landlord will not be associated with any properties or leases until the user adds the details.
2. Ability to create new properties for a landlord
The user needs to be able to enter the details (i.e. the street address) about a new Property and choose an existing Landlord as the recorded owner of the property. You must design an appropriate mechanism by which the user can enter this information, such that the property is initially considered as available for leasing.
3. Ability to create a new lease for a tenant
The user needs to be able to create new leases in the system. They should be presented with a list of all the available properties (i.e. ones that do not have a current lease), so the user can select which one to make the lease for. The program should then be able to enter all remaining details about the lease such as the tenant name, the weekly rent amount, whether it is a 6 or 12 month lease. The new lease should be recorded in the system, so that it could be used in the ‘pay rent’ behaviour. As lots of information is needed for this, and sometimes there are specific values that are valid, think carefully about which components are best to reduce the chance of erroneous input and explain your decisions in the supplementary documentation that you submit.
4. Ability to record the receipt of a rental payment
From time to time, the tenants will come to pay their rent. It is assumed that when they make payments, they will pay for whole weeks only. The program should allow the user to easily select which property the payment is for (possibly including specifying the landlord who owns the property). It should also ask how many weeks is being paid for. If the user enters a number that is greater than the number of weeks remaining on the lease, this should generate an error message rather than do any calculations. But if a sensible value is entered, this payment should be recorded, and the program should generate a message saying how many weeks still remain to be paid on the lease, if any.
5. Ability to record details of property maintenance during lease period
Sometimes there will be a need for repairs or other works to be done to the property to keep it liveable for the tenants, for example, maybe the water heating device breaks and needs to be replaced. The program needs to allow the user to select a property (that has an active lease), and to specify the cost and description of a maintenance task. It is possible there could be multiple maintenance tasks during the period of a single lease.
6. Ability to display a report about a landlord’s properties
The program should allow the user to select a landlord to produce a report (in a text-based component) about their net income for each of their properties, and to list the properties that are not currently leased. By net income is meant the amount left over after deducting the maintenance costs from the amount of rental income received during the particular lease.
This report should show the following information about each of the landlord’s properties:
• The address of the property
• Whether it is not currently leased; otherwise, the following details…
• Who the current tenant is
• The amount of rent charged each week
• A list of all the maintenance charges during the period of the lease
• The net income for this property during this lease.
For the list of maintenance, include both the cost as well as the description of the maintenance that was performed.
The following is an example of what may be displayed for the landlord named “Fred Flintstone” who has 2 properties leased to tenants, and another property that currently does not have a tenant.
Report for Landlord: Fred Flintstone
Property: 53 Spring St, Northland
Weekly Rental Rate: $240
Tenant: Donald Duck
6 Month Lease (20 remaining payments)
Maintenance History:
$800 new Hot Water Service
$140 Glass Window Repairs
Total Earnings: $500
Property: 107 Bedrock Avenue, Bedrock
Not currently leased
Property: 72 Long St, Westfield
Weekly Rental Rate: $685
Tenant: Clive Palmer
12 Month Lease (49 remaining payments)
Maintenance History:
None so far
Total Earnings: $2055
End of report for Fred Flintstone
Tasks to complete in your submission
Task 1 Designing and Documenting your system
1. Create a supplementary document named: surname StudentID Assign2.doc . In your document, you must include the following section headings: GUI Design, Testing.
GUI Design
Draw a schematic picture of your GUI design. On your diagram, highlight where you intend each panel to be and the contents of each panel (e.g. buttons, lists, radio buttons, labels). Where you have content to be displayed based on an object in your code, note this on your diagram. Also, indicate the events you expect your GUI to respond to and what happens following each event. For example, “when the button XXX is pressed, this event will trigger a call to method YYY which will perform a calculation using the values selected in the list and display the result in the text field in the center panel.”
Testing
As you develop your GUI classes and methods, you will write testing scenarios to verify that your code is working correctly. In this section, you will describe your chosen test data and explain how that data helps you test your code. Make sure that you choose a variety of test cases to ensure you can be satisfied that your code is working. Include screen shots of your testing results in this section.
Task 2 Creating your GUI
Using Eclipse, study the provided files, and add classes of your own, to make a functioning GUI-based program that achieves the behaviours outlined earlier in this document. In particular:
1. Write a new class named MySystemGui. In this class, you need to extend the JFrame class and implement the appropriate listeners so that your system will work. The main thing which must be provided by this frame is a mechanism by which to indicate which behaviour the user wishes to perform. For example, perhaps there are buttons that will open other frames when clicked; or maybe every behaviour is catered-for by this Frame. In any case, across the whole GUI system you must include the following elements somewhere:
class MySystemGui
I. at least 2 working buttons that trigger appropriate calculations or processing or reporting on information stored in underlying objects
II. at least 5 labels
III. Either radio buttons or checkboxes must be used in at least one place
IV. a JList must appear in at least one place somewhere in the system
V. a text field that allows the user to input a value to search for, with a button to trigger the search. When this button is pressed, the search will be triggered and the results will be displayed either to the console or a textarea in a panel on the GUI. (Note, the actual search may already be provided by the given code).
VI. You must yourself make use of an iterator to cycle through a group of objects in at least one place in the code you write.
VII. implementation of appropriate listeners to respond to events from buttons and other components.
2. In your MySystemGui class, create a main method that will instantiate your GUI when run.
3. In your documentation, explain how you have tested your code and the results of your testing. Include screen shots demonstrating the results when you tested your code.
You should aim to write code following high quality coding practices, including comments, trapped exceptions and exhibiting good design where code is separated into separate methods
Warning. In this task you are not allowed to use designer (drag and drop) tools provided by Eclipse or other IDEs. The whole program must be written manually. Failing to do so will result in no marks for the whole assignment.
Task 3 (ITECH 6100 students only)
Using examples from your own code, write half a page (at least 250 words) explaining the JFrame class in simple terms and each of the methods that you have used. Describe what an interface means and how you have in your assignment implemented an interface.
Allocated Marks: See Course Description
Due Date: See Course Description
Please refer to the Course Description for information relating to late assignments and special consideration.
Plagiarism:
Please refer to the Course Description for information regarding Plagiarism.
Assignment Submission:
Assignments must be submitted by the due date and your assignment should be completed according to the General Guidelines for Presentation of Academic Work (http://www.ballarat.edu.au/aasp/student/learning_support/generalguide/) and programming standards (http://www.oracle.com/technetwork/java/codeconventions-150003.pdf).
The following criteria will be used when marking of your assignment:
• successful compilation
• successful completion of the required tasks
• provision of all the required behaviors
• adherence to the guidelines provided
• quality of code that adheres to the programming standards for the Course, including:
• comments and documentation
• code layout
• meaningful variable names
You are required to provide the following documentation:
• a statement of what has been completed and acknowledgement of the names of all people (including other students and people outside of the university) who have assisted you and details on what parts of the assignment that they have assisted you with
• a table of contents and page numbers
• tasks requiring written documentation as specified
• list of references (including websites, the text book and any other resources) used (APA style); please clearly specify if none have been used.
• a printed copy of your code (this may be included as an Appendix). Please include this because we can provide more feedback this way
In addition to submitting a printed copy of your written report into your tutor’s assignment box (consult with your tutor if hardcopy is required), you should also submit the following using Moodle:
• an electronic copy of your code. Zip up the project itself and submit with the name surname idNo Assign2.zip
• a copy of your report (surnameStudentIDAssign2.doc)
GET ANSWERS / LIVE CHAT