A class named PropertyforRent to hold the following data: id: address totalRent
ID: 3772196 • Letter: A
Question
A class named PropertyforRent to hold the following data: id: address totalRent indicates the total expenses of a property, including rent and other expenses Desgin a class name HouseRent extends from PropertyforRent with following data: waterBill electricityBill gasBill Design a class name CondoforRent extends from PropertyforRent with following data: maintenance electricityBill Both CondoforRent and HouseforRent impelment an interface Comparable with the following method isCheaper(CondoforRent)/return true for false after compare the rents of two properties isCheaper(HouseforRent)//return true or false after compare the rents of two properties isCheaper(HoseforRent)//return ture or false after compare the rents of two properties You need to implement the constructions of the above classes.Explanation / Answer
#include<iostream.h>
#include<conio.h>
class PropertyforRent
{
protected:
int id;
string address;
total rent;
public:
void get()
{
cout<<"Enter the id :";
cin>>id;
cout<<"Enter address :";
cin>>address;
}
};
class HouseforRent:public PropertyforRent
{
protected:
int wbill;
int ebill;
int gbill;
public:
void getbill()
{
cout<<" Enter the waterbill :";
cin>>wbill;
cout<<" Enter the Elecbill :";
cin>>ebill;
cout<<" Enter the waterbill :";
cin>>gbill;
}
};
class CondoforRent:public PropertyforRent
{
protected:
int maint;
int ebill;
public
void getbill()
{
cout<<" Enter the maintenance :";
cin>>maint;
cout<<" Enter the Elecbill :";
cin>>ebill;
}
};
void main()
{
clrscr();
getbill obj;
obj.getbill();
obj.getbill();
obj.get();
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.