im tryin to do this and getin alot of errors to test my knowledge of classes i dont bother with shack got lazy lol
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
class house
{
public:
house();
~house();
void setage(int old);
int getage();
void priceset(int price);
int getprice();
int rent(int is);
private:
int old;
int price;
int is;
}
house::~house()
{
cout << "if this is called the classe is demolished" << endl;
}
void house::setage(int old)
{
this->old = old;
}
int house::getage()
{
return old;
}
void house::priceset(int price)
{
this->price = price;
}
int house::getprice()
{
return price;
}
int house::rent(int is)
{
switch(is)
{
case: int 1
return TRUE;
break;
default:
return FALSE;
}
if (is == TRUE)
{
cout << "For Rent!" << endl;
}
}
int main();
{
house Mansion;
house Victorian;
house Apartment;
house Shack;
Mansion.setage(2);
Mansion.setprice(10000000);
Victorian.setage(4);
Victorian.setprice(800000);
Apartment.setage(6);
Apartment.setprice(80);
Shack.setage(23);
Shack.setprice(300);
cout << "Four houses for sale, Mansion, Victorian, Apartment, and Shack" << endl;
cout << endl << "The Mansion is " << Mansion.getage(); << "years old...." << endl;
cout << "It costs a HEAPING $" << Mansion.getprice(); << "!" << endl;
cout << endl <<" The Victorian is " << Victorian.getage(); << "years old" << endl;
cout << " it costs $" << Victorian.getprice(); << "!" << endl;
cout << endl <<" the Apartment is " << Apartment.getage(); << " years old" << endl;
cout <<" it costs $" << Apartment.getprice() << "!" << endl;
Apartment.rent(1);
system("PAUSE");
return EXIT_SUCCESS;
}