Create the classes Property, House and Condo with the encapsulated variables shown above.

computer science

Description

Create the classes Property, House and Condo with the encapsulated variables shown above. Class Property should have the method toString() which will return a string that displays all the information encapsulated in the class. It also contains the methods getName() and getNrRooms(). Classes House and Condo contain the method calcTax() which produces and returns the property tax. Create class RealEstate, which encapsulates an array of Property objects named “prop” of dimension 10. This array will contain references to both House and Condo objects. 


Class RealEstate has the following methods: void addHouse(String name, String address, int nrRooms, int nrBath, double tRoom, double tBath); void addCondo(String name, String address, int nrRooms, double sqft, double tsqft); String printReport(); String printAllPropWithTaxesBelow(double am); String printAllPropWithNrRooms(int nr); The method printReport() will return a string that displays the information of all properties. For each property display in separate lines: The owner’s name The address The tax paid calculated POLYMORPHICALLY by method calcTax() (this will impose extra requirements in the way you program class Property). Make sure that the tax is presented as in “$3525.50” (i.e. with $ and two decimals) Create an empty line between properties. Method printAllPropWithTaxesBelow(double am) will produce a similar output as printReport() but only for the properties with taxes below the amount entered as the value of am.



 Method printAllPropWithNrRooms(int nr) will produce a similar output as printReport() but only for properties with 4 rooms or more. Use the following code for the class REDriver.java: public class REDriver { public static void main(String[] args) { RealEstate app = new RealEstate(); app.addHouse("Tim Jones", “24 Main Street”, 5, 3, 800.0, 200.0 ); app.addHouse("Marc Anthony", “7 Eleanor Circle”, 4, 2, 750.0, 170.0); app.addCondo("John Cusack", “3300 Yonge Street", 3, 1200.0, 2.5); app.addCondo("Tom Zhang”, “220 Eglinton Avenue", 2, 900.5, 3.0); app.addCondo("Cindy Singh", “445 Finch Avenue”, 3, 1402.5, 2.7); System.out.println(app.printReport()); System.out.println(“****************************************”); System.out.println(app.printAllPropWithTaxesBelow(3000.0)); System.out.println(“****************************************”); System.out.println(app.printAllPropWithNrRooms(4)); } } Note: Code which does not compile will receive maximum 10%.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.