Question

In: Computer Science

A property management company manages individual properties they will build to rent, and charges them a...

A property management company manages individual properties they will build to rent, and charges them a management fee as the percentages of the monthly rental amount. The properties cannot overlap each other, and each property must be within the limits of the management company’s plot. Write an application that lets the user create a management company and add the properties managed by the company to its list. Assume the maximum number of properties handled by the company is 5

Concepts tested: • Aggregation • Passing object to method • Array Structure • Objects as elements of the Array • Processing array elements • Copy Constructor • Junit test

Classes:

The class Property will contain: 1. Instance variables for property name, city, rental amount, owner, and plot. Refer to JavaDoc for the data types of each instance variable. 2. toString method to represent a Property object. 3. Constructors (a copy constructor and parameterized constructor) and getter and setter methods. One parameterized constructor will have parameters for property name, city, rent amount, owner, x and y location of the upper left corner of the property’s plot, the plot’s width and its depth. A second constructor will only have parameters for name, city, rental amount, and owner, and will generate a default x, y, width, and depth.

The class Plot will contain: 1. 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. 2. A toString method to represent a Plot object 3. Constructors (a no-arg constructor, a copy constructor and a parameterized constructor) 4. A method named overlaps that takes a Plot instance and determines if it is overlapped by the current plot. 5. 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. This class should not have any output functionality (e.g., no GUI-related or printing related functionality), but should take input, operate on the data structure, and return values or set variables that may be accessed with getters.

The class ManagementCompany will contain the following methods in addition to get and set methods: 1. Instance variables of name, tax Id, management fee, MAX_PROPERTY (a constant set to 5) and an array of size MAX_PROPERTY of Property objects. 2. Constructor managementCompany – pass in arguments for the name of the management company, tax Id and management Fee, along with the X, Y, width, and depth of the overall plot that will be subdivided into plots for each property. A ManagementCompany object will be created. 3. Constructor managementCompany – pass in arguments for the name of the management company, tax Id and management Fee to create a ManagementCompany object. A default plot will be created with programmer-determined values into which to subdivide the plots for each property. 4. Method addProperty (3 versions) – a. Pass in a parameter of type Property object. It will add the Property object to the properties array. b. Pass in four parameters of types: i. String propertyName, ii. String city, iii. double rent, and iv. String ownerName. c. Pass in eight parameters of types: i. String propertyName, ii. String city, iii. double rent, iv. String ownerName, v. int x, vi. int y, vii. int width, and viii. int depth. d. It returns -1 if the array is full, -2 if property is null, -3 if the plot is not contained by the MgmtCompany’s plot, -4 if the plot overlaps any other property, or the index in the array where the property was added successfully. 5. Method totalRent– Returns the total rent of the properties in the properties array. 6. Method maxPropertyRent-returns the String representation of the property within the properties array that has the highest fee amount. For simplicity assume that each "Property" object's fee amount is different. 7. Method maxPropertyIndex- returns the index of the property within the properties array that has the highest fee amount. This method will be private. 8. Method displayPropertyAtIndex– pass in the index of the Property object in the properties array and return the string representation of the property. This method will be private.

Driver class – (provided)

GUI Driver class – (provided)

JUnit Test (provided)

Write a Data Element Class named Property that has fields to hold the property name, the city where the property is located, the rent amount, the owner's name, and the Plot to be occupied by the property, along with getters and setters to access and set these fields. Write a parameterized constructor (i.e., takes values for the fields as parameters) and a copy constructor (takes a Property object as the parameter). Follow the Javadoc file provided.

Write a Data Element Class named Plot that has fields specifying the X and Y location of the upper left corner of each Plot and a depth and width of each Plot. Notice that the X,Y location is at the upper left, not as in normal Cartesian coordinates, due to the grid system adopted by computer monitors. A driver class is provided that creates rental properties to test the property manager. A Graphical User Interface is provided using JavaFX which duplicates this driver’s functionality. You are not required to read in any data, but the GUI will allow you to enter the property management company and each property by hand. A directory of images is provided. Be sure to place the “images” directory (provided) inside the “src” directory in Eclipse. Operation When driver-driven application starts, a driver class (provided) creates a management company, creates rental properties, adds them to the property manager, and prints information about the properties using the property manager’s methods. When the GUI-driven application starts (provided), a window is created as in the following screen shots which allows the user to enter applicable data and display the resulting property. The driver and the GUI will both use the same classes and methods for their operation. The JUnit test class also tests the same classes as the driver and the GUI.

Can someone please help me with the Plot class?

Solutions

Expert Solution

import java.util.Arrays;

public class ManagementCompany {

        
        private final int MAX_PROPERTY = 5;
        private double mgmFeePer;
        private String name;
        private Property[] properties;
        private String taxID;
        private int MAX_WIDTH = 10,count=0;
        private int MAX_DEPTH = 10;
        private Plot plot ;
        
        /**
         * A No-Arg Constructor that creates a Management Company object.
         */
        public ManagementCompany() {
                properties = new Property[MAX_PROPERTY];
                this.name= "";
                this.taxID = "";
                this.plot = new Plot (0,0,MAX_WIDTH,MAX_DEPTH );
                
        }
        
        /**
         * A management company parameterized  constructor with a default company plot.
         * @param name name of the company
         * @param taxID taxID of the property
         * @param mgmFeePer management fee
         */
        public ManagementCompany(String name, String taxID, double mgmFeePer) {
                properties = new Property[MAX_PROPERTY];
                this.name = name;
                this.taxID = taxID;
                this.mgmFeePer = mgmFeePer;
                this.plot = new Plot (0,0,MAX_WIDTH,MAX_DEPTH );
        }
        
        /**
         * Copy constructor creates a ManagementCompany object using another ManagementComapany object..
         * @param otherCompany otherCompany is an object that is a copy 
         */
        public ManagementCompany(ManagementCompany otherCompany) {
                properties = new Property[MAX_PROPERTY];
                name = otherCompany.name;
                taxID = otherCompany.taxID;
                mgmFeePer = otherCompany.mgmFeePer;
                plot = otherCompany.plot;
        }
        
        /**
         * A management company parameterized constructor that sets the plot for the company. 
         * @param name
         * @param taxID
         * @param mgmFeePer
         * @param x
         * @param y
         * @param width
         * @param depth
         */
        public ManagementCompany(String name, String taxID, double mgmFeePer,int x, int y, int width, int depth) {
                properties = new Property[MAX_PROPERTY];
                this.name = name;
                this.taxID = taxID;
                this.mgmFeePer = mgmFeePer;
                this.plot = new Plot( x, y, width, depth);
                
                
        }
        
        
        /**
         * A get method that returns the size of properties array. 
         * @return MAX_PROPERTY size of the array. 
         */
        public int getMAX_PROPERTY() {
                return MAX_PROPERTY;
        }
        
        /** 
         * Adds a an already created property to the array. 
         * @param property
         * @return
         */
        public int addProperty(Property property) {
                int i;
        
                
                for( i =0; i < count; i++) {
                        if(properties[i].getPlot().overlaps(property.getPlot()))
                                return -4;
                        
                }
//                      if(property!=null)
//                      {
//                              properties[count]=property;
//                              count++;
//                              return count;
//                      }
        
                
                if(count == MAX_PROPERTY) {
                        return  -1;
                }
                 if(property== null) {
                        return  -2;
                
        }
           if(this.plot.encompasses(property.getPlot()) ) {
                return  -3;
        }
           else 
                {
                        properties[count]=property;
                        count++;
                        return count;
                }
                
        
        }
        /**
         * A method that adds the property with four arguments and a default plot to the array.
         * @param name
         * @param city
         * @param rent
         * @param owner
         * @return
         */
        public int addProperty(String name, String city, double rent, String owner){
                
                //create a property object.
                Property property = new Property(name, city, rent, owner, 0, 0, 1,1);
                //adds the property object to properties array. 
                properties[count] = property;
                count++;
                int i;
                for( i =0; i < count; i++) {
                        if(properties[i].getPlot().overlaps(property.getPlot()))
                                return -4;
                        
                }
                
                
                if(count == MAX_PROPERTY) {
                        return -1;
                }
                if(this.plot.encompasses(property.getPlot())) {
                //else if()
                return -3;
                }
                else 
                {
                        properties[count]=property;
                        count++;
                        return count;
                }
        }
        
        /**
         * An add property that has all the parameters for the property and the plot. 
         * @param name
         * @param city
         * @param rent
         * @param owner
         * @param x
         * @param y
         * @param width
         * @param depth
         * @return
         */
        
        public int addProperty(String name, String city,double rent, String owner, int x, int y, int width,int depth) {
                int i;
                //Creates a property object that calls the constructor of Plot. 
                Property property = new Property(name, city, rent, owner, x, y,width, depth);
                //Adds the property object to the properties array.
                properties[count] = property;
                
                // create a plot
                //Plot plot = new Plot(x,y, width, depth);
                
                // Question is this the correct way of checking if the plot overlaps with the other property plots?????
                for( i =0; i < count; i++) {
                        if(properties[i].getPlot().overlaps(property.getPlot()))
                                return -4;
                        
                }
                if(count == MAX_PROPERTY) {
                        return  -1;
                }else if(this.plot.encompasses(property.getPlot()) ) {
                        return  -3;
                }
                else 
                {
                        properties[count]=property;
                        count++;
                        return count;
                }
                
        }
                
        

        
        /**
         * A method that adds up all the amounts of rent. 
         * not finished yet. 
         */
        public double totalRent() {
                double totalRent =0.0 ;
                
                for(int i = 0; i < count; i++) {
                        if(properties[i] != null) {
                                
                        
                                totalRent += properties[i].getRentAmount();
                        }
                }
                return totalRent;
        }
        
        
        public double maxPropertyRent() {
                double maxRentAmount = 0.0;
                
                maxRentAmount = properties[maxPropertyRentIndex()].getRentAmount();
                
                
                
                return maxRentAmount;
        }
        
        
        public int maxPropertyRentIndex() {
                int indexOFMaxRent=0;
                
                for (int i =0; i < count; i++) {
                        if(properties[i] != null) {
                                if(properties[indexOFMaxRent].getRentAmount() < properties[i].getRentAmount()) {
                                        indexOFMaxRent = i;
                                }
                        }
                }
                
                return indexOFMaxRent;
        }
        
        public String displayPropertyAtIndex(int i) {
                String str = "";
                if(properties[i] != null) {
                        str= ("Owner: " + properties[i].getOwner() + "City: " + properties[i].getCity() 
                                        + "Property Name: " + properties[i].getPropertyName() + "Rent Amount: " + properties[i].getRentAmount()
                                        + "Plot: " + properties[i].getPlot());
                        
                }
                
                return str;
                
        }
        
        public String toString() {
                
                String printContent = "";
                System.out.println("List of the properties for Alliance, taxID: " + taxID );
                
                System.out.println("__________________________________________________");
                
                for(int i = 0; i < count; i++) {
                        
                        if(properties[i] != null)
                                printContent = (" Property Name: " + properties[i].getPropertyName() +"\n" +
                                        "  Located in: " + properties[i].getCity() + "\n" + 
                                        "  Belonging to: " + properties[i].getOwner() + "\n" + 
                                        "  Rent Amount: " + properties[i].getRentAmount()); 
                        
                }
                
                System.out.println("__________________________________________________");
                System.out.println("Total management Fee: " + mgmFeePer);
                
                
                return printContent;
        }

                
                
}
        
        
        
        
        
        
        
        
        
        
        

Related Solutions

A property management company manages individual properties they will build to rent, and charges them a...
A property management company manages individual properties they will build to rent, and charges them a management fee as the percentages of the monthly rental amount. The properties cannot overlap each other, and each property must be within the limits of the management company’s plot. Write an application that lets the user create a management company and add the properties managed by the company to its list. Assume the maximum number of properties handled by the company is 5 Project...
This is the requirement: A property management company manages personal rental properties and charges them a...
This is the requirement: A property management company manages personal rental properties and charges them a management fee as the percentages of the rent amount. Write an application that lets the user create a management company and add the properties managed by the company to its list. Assume the maximum properties handled by the company is 5. Write a Data Manager Class named ManagementCompany that holds a list of properties in an array structure. This class will have methods to...
A property owner charges a rent of $30 in the first year, $34 in the second...
A property owner charges a rent of $30 in the first year, $34 in the second year, and $36 in the third year, but provides two months of free rent in the first year as a concession. Using an 8 percent discount rate, what is the effective rent over the three years? a) $32.18 b) $33.27 c) $33.89 d) $34.91
Green Properties Group owns, manages, and develops real property. Jones Group, Inc. also develops real property....
Green Properties Group owns, manages, and develops real property. Jones Group, Inc. also develops real property. Green entered into agreements with Jones concerning a large tract of property in Georgia. The parties formed NewGroup, LLC, to develop various parcels of the tract for residential purposes. The operating agreement of NewGroup indicated that “no Member shall be accountable to the LLC or to any other Member with respect to any other business or activity even if the business activity competes with...
Design and build objects to be used by a real estate company for listing the properties for sale. A base object of a property is necessary.
IN JAVA OOPDesign and build objects to be used by a real estate company for listing the properties for sale. A base object of a property is necessary. Decide what common about all properties and include these in the property object. Different type of properties are land, commercial and residential. A residential property can be single family and multi family. A commercial can be a commercial can be either a farm or non-farm.Look at real estate websites and decide what...
13. A property management group is interested in diversifying its company to operate properties for low-income...
13. A property management group is interested in diversifying its company to operate properties for low-income housing, but the group members are nervous about the impact on the brand of high-end apartment developments where they have been operating. What strategy should the property management group use to diversify but keep control of both divisions? a.Related diversification b. Internal new venture c. Unrelated diversification d. Joint venture 14. Which of these companies is pursuing a strategy of unrelated diversification? a.Best Buy...
Mel O’Conner operates rental properties in Michigan. Each property has a manager who collects rent, arranges...
Mel O’Conner operates rental properties in Michigan. Each property has a manager who collects rent, arranges for repairs, and runs advertisements in the local newspaper. The property managers transfer cash to O’Conner monthly and prepare their own bank reconciliations. The manager in Lansing has been stealing from the company. To cover the theft, he overstates the amount of the outstanding checks on the monthly bank reconciliation. As a result, each monthly bank reconciliation appears to balance. However, the balance sheet...
Jim Coleman, Jr. was appointed the manager of Maris Properties, a recently formed company that manages...
Jim Coleman, Jr. was appointed the manager of Maris Properties, a recently formed company that manages residential rental properties. Linda Grider is the accountant. She prepared a chart of accounts based on an analysis of the expenditures of the company. Two of the largest expense categories are Travel and Entertainment. Mr. Coleman believes that it is important to maintain a presence in the social life of the city. In this, he sharply differs from his father, Jim Coleman, Sr. The...
Jim Coleman, Jr. was appointed the manager of Maris Properties, a recently formed company that manages...
Jim Coleman, Jr. was appointed the manager of Maris Properties, a recently formed company that manages residential rental properties. Linda Grider is the accountant. She prepared a chart of accounts based on an analysis of the expenditures of the company. Two of the largest expense categories are Travel and Entertainment. Mr. Coleman believes that it is important to maintain a presence in the social life of the city. In this, he sharply differs from his father, Jim Coleman, Sr. The...
Jim Coleman, was appointed the manager of Maris Properties, a recently formed company that manages residential...
Jim Coleman, was appointed the manager of Maris Properties, a recently formed company that manages residential rental properties. Linda Grider is the accountant. She prepared a chart of accounts based on an analysis of the expenditures of the company. One of the largest expense categories is Travel and Entertainment. Mr. Coleman believes that it is important to maintain a presence in the social life of the city. In this, he sharply differs from his father, Randall Coleman. Randall has set...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT