Question: HERE IS WHAT I HAVE SO FAR: ManagementCompany.java package Package; public class ManagementCompany { private int MAX_PROPERTY = 5; private double mgmFee; private String name;

HERE IS WHAT I HAVE SO FAR:

ManagementCompany.java

package Package;

public class ManagementCompany

{

private int MAX_PROPERTY = 5;

private double mgmFee;

private String name;

private Property[] properties=new Property[MAX_PROPERTY];

private String taxID;

//Create a index variable to keep track of current index of properties array.

int index=0;

public ManagementCompany(String name, String taxID, int mgmFee) {

this.name=name;

this.taxID=taxID;

this.mgmFee=mgmFee;

}

public int addProperty(Property p1) {

//Check if index >= MAX_PROPERTY means array is full, return -1

if(index>=MAX_PROPERTY){

return -1;

}else{

//Else, store object to current index.

properties[index]=p1;

//Increment index to point to next location

index++;

//Return index-1 to return index where property was added.

return index-1;

}

}

public String displayPropertyAtIndex(int index) {

//Create a string output and add values of properties array at given index

String output=properties[index].toString();

return output;

}

public int getMAX_PROPERTY() {

return MAX_PROPERTY;

}

public int maxPropertyRentIndex() {

//Create variable maxRent to represent maximum rent

double maxRent=0;

//Create variable maxRentIndex to represent maximum rent index

int maxRentIndex=0;

//Iterate through all the objects present in properties array

for(int i=0;i

//If maxRent is < current property, change max rent to current's property rent and maxRentIndex to current index.

if(maxRent

maxRent=properties[i].getRentAmount();

maxRentIndex=i;

}

}

//return maxRentIndex;

return maxRentIndex;

}

public double totalRent() {

double totalRent = 0;

//Iterate through all the objects present in properties array and add all rents

for(int i=0;i

totalRent+=properties[i].getRentAmount();

}

return totalRent;

}

public String toString() {

String output="";

//Iterate through all the objects present in properties array and add information of all property in output variable.

for(int i=0;i

output+=properties[i].toString()+" ";

}

return ("List of the properties for Mananagemen Company, "

+ "Alliance, taxid, 1235 ------------------------------------------- "+output+"------------------------------------------- total management Fee:"+this.mgmFee);

}

}

Property.java

package Package;

public class Property

{

private String city;

private String owner;

private String propertyName;

private double rentAmount;

public Property () {

city = "";

owner = "";

propertyName = "";

rentAmount = 0.0;

}

public Property (Property p)

{

propertyName = p.propertyName;

city = p.city;

rentAmount = p.rentAmount;

owner = p.owner;

}

public Property(String propertyName, String city, double rentAmount,String owner) {

this.propertyName = propertyName;

this.city = city;

this.rentAmount = rentAmount;

this.owner = owner;

}

public void setLoc(String city) {

this.city = city;

}

public String getPropertyName() {

return propertyName;

}

public String getCity() {

return city;

}

public double getRentAmount() {

return rentAmount;

}

public void setRentAmount(double rentAmount) {

this.rentAmount = rentAmount;

}

public String getOwner() {

return owner;

}

public void setOwner(String owner) {

this.owner = owner;

}

public String toString() {

//Property name belonging to rent amount

return "Property Name: "+this.propertyName+" "+

"Located: "+this.city+" "+

"Belonging to: "+this.owner+" "+

"Rent Amount: "+this.rentAmount;

}

}

I have not written the Plot.java and thats what i think i need help with.

Data Element class Plot.java

The class Plot will contain:

Instance variables to represent the x and y coordinates of the upper left corner of the location, and depth and width to represent the vertical and horizontal extents of the plot.

A toString method to represent a Plot object

Constructors (a no-arg constructor, a copy constructor and a parameterized constructor)

A method named overlaps that takes a Plot instance and determines if it is overlapped by the current plot.

A method named encompasses that takes a Plot instance and determines if the current plot contains it. Note that the determination should be inclusive, in other words, if an edge lies on the edge of the current plot, this is acceptable.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!