• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Write a program with differenet classes ,to have the information of all the apartments in an appartment building

Hi,I am writing a program in C++,for a real estate agent where i can store all the information of different type of appartment ,houses,condominum in different classes,and the info the user when he want to sell or rent the  house.
Can any1 plezz give some ideas ,as how exactly i need to start ,as i have an idea of creating the whole program  by using one main class ,but how to create different classes and merege all all them into the final program.
0
anumit
Asked:
anumit
1 Solution
 
rcarlanCommented:
What O/S do you want the program to run on?
Do you want it to have a GUI?
If the answer to the last question is yes, what libraries do you have at your disposal?

0
 
VolatileVoidCommented:
I'd probably leverage inheritance here since there are some things every dwelling has:

class Lodging {
public:
  enum { APARTMENT, CONDO, HOUSE, };
  string getAddress ();
  virtual int getLodgingType () = 0;
  int getNumBedrooms ();
  int getNumBathrooms ();
  int getCost ();
protected:
  string address;
  int numbr;
  int numbath;
  int cost;
}

class Apartment : public Lodging {
public:
  virtual int getLodgingType () { return Lodging::APARTMENT; };
  // ... etc ...
}

There are some things Apartments only have and some thing Houses only have and some things Condos only have so you'd probably want to write different classes for each and then keep an array / vector / whatever of Lodging*s.
 
0
 
jhshuklaCommented:
plus you also need some sort of storage structure. I recommend Map from STL: http://www.sgi.com/tech/stl/Map.html

Actually you would be much better off using SW created specifically for databases - SQL,etc. I am not too much knowledgeable about it but you can ask the same question in databases TA (http://experts-exchange.com/Databases/) and they would provide much better assistance.

j
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now