• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • 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.
1 Solution
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?

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

class Lodging {
  string getAddress ();
  virtual int getLodgingType () = 0;
  int getNumBedrooms ();
  int getNumBathrooms ();
  int getCost ();
  string address;
  int numbr;
  int numbath;
  int cost;

class Apartment : public Lodging {
  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.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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