In real estate, a "property manager" is responsible for renting and maintaining properties owned by clients. For providing this service, property managers charge the client a fee. For this assignment, we assume the fee is calculated as a percentage of the rental income.
The property manager needs to record income (i.e. rent collected) and expenses (i.e. maintenance costs and monthly fees) for each property. If a client owns more than one property, their entire collection of properties is known as a "portfolio". The property manager also needs to be able to generate portfolio reports for clients, which provide a summary of income, fees, and expenses for all the properties in that client's portfolio.
In this assignment, your task is to create an object-oriented, menu-driven Java program that implements a limited set of functionalities (i.e., the program will not be a completely real-world implementation) that a property manager can use to record rental income and expenses for each client's property, generate portfolio reports, and retrieve and save data in secondary storage.
In general, 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 and search the data, and write output data to both the screen and to secondary storage. The specific functional requirements are described in section B(ii) of this document. The text files that are to be used for this assignment are described in section B(iii). The classes that must be used as a minimum are described in section B(iv).
The Java program must
a) be object-oriented utilising the classes described in section B (iv) 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. Record Rent Collection.
2. Record Expense.
3. Generate Portfolio Report.
4. Save
5. Exit Program
c) be able to process the defined text files. The text files and their formats are described in section B (iii).
Program Start Up
When the java program starts it must perform the following file related operations:
d) Read the data from the clients.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the clients.txt file and section B (iv) for a description of the Clients class). If the clients.txt file does not exist, then the user should be informed of this and given the opportunity to provide an alternative filename that contains the client data;
e) Read the data from the properties.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the properties.txt file and section B (iv) for a description of the Properties class). If the properties.txt file does not exist, then the user should be informed of this and given the opportunity to provide an alternative filename that contains the property data;
f) Read the data from the expenses.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the expenses.txt file and section B (iv) for a description of the Expenses class). If the expenses.txt file does not exist, then the user should be informed of this and given the opportunity to provide an alternative filename that contains the portfolios data;
g) Read the data from the rents.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the rents.txt file and section B (iv) for a description of the Rents class). If the rents.txt file does not exist, then the user should be informed of this and given the opportunity to provide an alternative filename that contains the rents data.
After processing these four files the program should display the main menu identified in section B(ii)(b) above.
Main Menu Item Functionality
The required functionality for each menu item is described as follows:
1. Record Rent Collection - when this menu option is selected the following actions should be performed by the program:
2. Record Expense - when this menu option is selected the following actions should be performed by the program:
3. Portfolio Report - when this menu option is selected the following actions should be performed:
Note:
4. Save - All rent and expense information entered by the user via the menu items "Record Rent Collection" and Record Expense must be saved to the files rents.txt and expenses.txt respectively. Pre-existing data in rents.txt and expenses.txt must be preserved. Clients.txt and properties.txt should not be changed.
5. Exit Program - the program must terminate when this menu item is selected. The program should not terminate until this option is chosen. If the rent or expense data has changed since the last save then do not exit the program. Instead, warn the user that they should choose the Save option, then return program control to the main menu.
The data that is to be manipulated by your Java program for this assignment is contained in the text files clients.txt, properties.txt, expenses.txt and rents.txt. Examples of these text files are found in the zip file for the assignment. Two different datasets have been provided. 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 the assignment. The text files have been created to conform to a particular format. The format for each file is described below:
File: clients.txt
This file contains a list of all clients managed by the property manager.
Each line within the file represents an individual client, and has the following format:
Client ID, Client Name, Client Address
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Client ID: a unique numeric identifier for a client
Client Name: the client’s name in the format: first-name last-name
Client Address: the address of the client to which correspondence should be mailed
File: properties.txt
This file contains a list of all properties managed by the property manager.
Each line within the file represents an individual property, and has the following format:
Property ID, Property Address, Weekly Rent, Management Fee, Client ID
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Property ID: a unique numeric identifier for a property
Property Address: the property’s address
Weekly Rent: the rental amount charged for the property per week in dollars
Management Fee: the percentage of the weekly rent claimed as a fee for managing this property.
Client ID: the client ID of the property’s owner.
File: expenses.txt
This file contains a list of all expenses for all properties.
Each line within the file represents an individual expense, and has the following format:
Property ID, Expense Description, Expense Amount, Date
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Property ID: the unique numeric identifier of the property for which the expense was incurred
Expense Description: a description of the expense, e.g. “fix leaking tap”
Expense Amount: the cost of the expense
Date: the date on which the expense was incurred in yyyy-mm-dd format
File: rents.txt
This file contains a list of all rental income for all properties.
Each line within the file represents an individual rent collection event, and has the following format:
Property ID, Rent Amount, Date
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Property ID: the unique numeric identifier of the property for which the rent was collected
Rent Amount: the monetary amount of rent collected
Date: the date on which the rent was collected in yyyy-mm-dd format
Notes:
1. 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(iv).
2. For the purpose of marking the assignment, the number of lines of data and the data values in the text files will be replaced with different data by the marker. This is to ensure that your solution has not relied upon specific data values or the number of lines in the text files to work. You should therefore test your program with different data files of varying length and varying data before submission.
To write your solution for this assignment it is a requirement that you write appropriate code for at least the following java Classes:
a) Client
b) Property
c) Expense
d) Rent
These classes are described in general terms as follows:
a) Client class: The Client class represents an individual client (customer). The Client class needs data fields for the client ID, first name, surname, and address. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the Client class is required to perform any other actions and implement the identified methods in the class.
b) Property class: The Property class represents a single property that an individual Client owns. The Property class needs data fields for the property ID, property address, the weekly rent, the management fee, and the client ID of the property's owner. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the property class is required to perform any other actions and implement the identified methods in the class.
c) Expense class: The Expense class represents an individual Expense incurred by a property. The Expense class needs data fields for the property ID, the expense description, the expense amount, and the date on which the expense was incurred. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the expense class is required to perform any other actions and implement the identified methods in the class.
d) Rent class: The Rent class represents an individual rent collection for a property. The Rent class needs data fields for the property ID, the rent amount, and the date on which the rent was collected. Implement appropriate constructors, accessors, and mutators where necessary and other appropriate methods for this class based upon the general requirements of the assignment specification - that is, you will need to identify if the rent class is required to perform any other actions and implement the identified methods in the class.
Apart from the above four classes it is possible that you will also need to write other classes depending upon your solution method.