Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Create an abstract class named RealEstateProperty with fields for an address and a price. Include a constructor that requires parameters for both fields and

image text in transcribed
Instructions Create an abstract class named RealEstateProperty with fields for an address and a price. Include a constructor that requires parameters for both fields and get and set methods for both fields. Also include an abstract method with no parameters named description) that returns a String. Declare the class as public and save the file as RealEstateProperty.java Create an interface named Rentable that contains that contains a constant named monthlyRent that is initialized to 750.0. The interface should also contain a a method with no parameters named annualRentAmoun file as Rentable.java t0 that returns a double. Declare the interface as public and save the Create two child classes of RealEstateProperty class with names SingleFamilyDwelling and MultipleFamilyDwelling. The SingleFamilyDwelling class should implement the Rentable interface. The annual rent fora single family dwelling would be 12 times the monthly rent. The SingleFamilyDwelling class should have a field named squareFeet and the description) method should show the value of all of its fields as well as the annual rent amount. The description) method should call the annualRentAmount) method to get the annual rent amount instead of recalculating it. The SingleFamilyDwelling should have a constructor that requires values for address, price, and squareFeet. Declare the class as public and save the file as SingleFamilyDwelling.java The MultiFamilyDwelling class should implement the Rentable interface. The annual rent for a multi-family dwelling would be 12 times the monthly rent times the number of units. The MultiFamilyDwelling class should have a field named numberUnits and the description0 method should show the value of all of its fields as well as the annual rent amount. The description) method should call the annualRentAmount) method to get the annual amount instead of recalculating it. The MultiFamilyDwelling class should have a constructor that requires values for address, price, and numberUnits. Declare the class as public and save the file as MultiFamily Dwelling.ja Write an application that creates a SingleFamilyDwelling object and a MultiFamilyDwelling object, calls the description method of each object, and displays the results to the screen. Declare the class as public and save the file as RealEstateDemo.java Submit the RealEstateProperty.java, Rentable java, SingleFamilyDweling java MultiFamilyDwelling,java, and RealEstateDemo.java files containing your source code. Failure to follow the file name scheme will result in a Declare your class as public! reduction to your grade

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions