B(i) Background information and description

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).

B(ii) - Program Requirements/Functionality

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:

  • Allow the user to find the property for which the rent was collected by entering the property's address.
  • Display the property's address, weekly rent charged, and property owners full name.
  • The program should ask the user how many weeks of rent was collected.
  • Calculate the amount of rent collected based upon the weekly rent rate and the number of weeks entered by the user.
  • Record the rent collection. Ensure your program enforces all logical validation conditions when doing so.
  • Generate an on-screen summary of the rent collection transaction. The summary must show the property address, the monetary amount, the number of weeks rent collected, the property owner's name, and the current date. Make sure that this is displayed in a clear and logical format on the screen.

2. Record Expense - when this menu option is selected the following actions should be performed by the program:

  • Allow the user to find the property for which the expense was incurred by entering the property's address.
  • Display the property's address, weekly rent charged, and property owners full name.
  • Allow the user to record an expense, which must include the current date, a monetary amount greater than 0, and a description of the expense. Ensure your program enforces all logical validation conditions when doing so.
  • Generate an on-screen summary of the expense. The summary must show the property address, the monetary amount, the description of the expense, the property owner's name and address, and the current date. Make sure that this is displayed in a clear and logical format on the screen.

3. Portfolio Report - when this menu option is selected the following actions should be performed:

  • Determine if the report is for all clients or for a specific client.
  • Generate the Portfolio Report for either the specified client or all clients.
  • The Portfolio Report displays a summary of the rent, expenses and fees for all properties owned by that client.
  • The Portfolio Report should have a similar layout to the following example: see image.

Note:

  • The "Start Date" should be the earliest date on record for either an expense or rent collection for that client.
  • The "End Date" should be the most recent date on record for either an expense or rent collection for that client.
  • The "Rent" column should display the total amount of rent collected for the specified period.
  • The "Expenses" column should display the total amount of expenses incurred for the specified period.
  • The "Fee Rate" column should display the correct rate for that property, as per properties.txt
  • The "Fees" column should be calculated by multiplying the rent collected by the fee rate.
  • The "Net" column is calculated by subtracting expenses and fees from the rent collected.

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.

B(iii) - Text files to be processed

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.

B(iv) - Required Classes

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.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.