Ok, I have this code where I have to add 5 Properties
Returns either -1 if the array is full, -2 if property is null, -3 if the plot is not contained by the MgmtCo plot, -4 of the plot overlaps any other property, or the index in the array where the property was added successfully. This is my code, it gives me an error in my Junit test when I try to add the fourth property public int addProperty(Property property){ int empty; if(property==null){ return -2; } for(empty =0; empty<5; empty++) { if(properties[empty]==null){ countindex = empty; break; } } if(countindex==MAX_PROPERTY){ return -1; } else { for( empty= 0; empty<countindex; empty++){ if(properties[empty].getPlot().overlaps(property.getPlot())) return -4; } } if(!plot.encompasses(property.getPlot())) { return -3; } else { properties[countindex]=property; countindex++; return countindex; } }