A class named PropertyforRent to hold the following data: Design a class name Ho
ID: 3771710 • Letter: A
Question
A class named PropertyforRent to hold the following data: Design a class name HouseforRent extends from PropertyforRent with following data: Design a class name CondoforRent extends from PropertyforRent with following data: Both CondoforRent and HouseforRent implement an interface Comparable with the following method isCheaper(CondoforRent) //return true or false after compare the rents of two properties isCUeaper(HouseforRent) //return true or false after compare the rents of two properties You need to implement the constructors of the above classes.Explanation / Answer
import java.util.*;
import java.io.*;
public void class PropertyforRent
{
int id=20;
String address=america;
int totalRent=10000;
int totalexpenses=10000;
public void PropertyforRent()
{
System.out.println("id:"+id);
System.out.println("address:"+address);
System.out.println("totalRent:"+totalRent);
System.out.println("totalexpenses:"+totalexpenses);
}
public static void main(String args[]){
PropertyforRen al=new PropertyforRent;
al.PropertyforRent();
al.HouseforRent();
al.CondoforRent();
}
}
public void class HouseforRent extends PropertyforRent
{
int waterBill=1000;
int eletricityBill=1200;
int gasBill=1300;
public void HouseforRent()
{
System.out.println("waterBill:"+waterBill);
System.out.println("eletricityBill:"+eletricityBill);
System.out.println("gasBill:"+gasBill);
}
}
}
public void class CondoforRent extends PropertyforRent
{
int maintence=2300;
int eletricityBill=1400;
public void class CondoforRent();
{
System.out.println("maintence:"+maintence);
System.out.println("eletricityBill:"+eletricityBill);
}
}
public interface Comparable extends CondoforRent,HouseforRent
{
public isCheaper(boolean CondoforRent)
{
boolean CondoforRent = true;
if ( CondoforRent== true) {
System.out.println("it's true");
}
else {
System.out.println("it's false");
}
}
public isCheaper(boolean HouseforRent)
{
boolean HouseforRent = true;
if ( HouseforRent== true) {
System.out.println("it's true");
}
else {
System.out.println("it's false");
}
}
}
thank you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.