Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi friends plz help me with this task........ I need to create c++ classes with help of object diagram shown below

TASK:

You are required to provide a practical implementation in C++ for the following class diagram. You have to provide the solution in the form of classes in C++.

Diagram link
https://skydrive.live.com/redir?resid=8B2D8A874799F882!158&authkey=!AGWdCBkmuXTfLLA[^]

Detail Description
You are required to give C++ implementation of following classes:

1. PropertyCategories
2. Plot
3. Flat
4. House

Following is the description of all data member and member functions of respective classes:

 Data members for PropertyCategories:

o SocietyName: This data member will be used to know the society/town name from where flat, house or plot belongs to.
o Area: Total area covered by the plot, flat or house. Area will be in square feet or Marla unit.


 Methods for PropertyCategories:
o Constructor(s) and destructor.
o Setter and getter function for Area andSocietyNamedata members.

 Data members for Plot:
o PlotNo: A number associated with a plot will be shown to user.

 Methods for Plot:
o Constructor(s) and destructor.
o Setter and getter function for PlotNodata member.
o isPlotAllotted() will ensure whether plot is already allotted or not. If plot is not already allotted to anyone then assign it to current user and make it allotted.
o isCornerPlot () will check whether current plot is corner plot or not. You can take input from user in this regard.
o isDeveloped () this will ensure that whether plot is in developed status or not. A plot is consider to be developed if, facilities such as electricity, gas, road etc are available, otherwise it will be consider undeveloped plot.

 Data members for Flat
o FlatNo: A number associated with a flat will be shown to user.

 Methods for Flat
o Constructor(s) and destructor.
o Setter and getter function for FlatNodata member.
o isOccupied() will check whether this flat is available for rent, selling purpose or not. If anyone is staying in the flat then we can’t rent out or sell this flat.

 Data members for House
o HouseNo: A number associated with a house will be shown to user.

 Methods for House
o Constructor(s) and destructor for class.
o Setter and getter function for HouseNodata member.
o isOccupied() will check whether this house is available for rent, selling purpose or not. If anyone is staying in this house then we can’t rent out or sell this house.

Plz friends help me its urgent

NOTE: i don't need it to implement into the program ..... Just a task from college


[Edited by Jibesh based on OPs comment]
Please can you tell the inheritance relationship between class shown in the diagram ..... Coz i know how to create classes, members the only thing that matters is the relationship between classes
Posted
Updated 11-Jan-13 12:28pm
v4
Comments
Jibesh 11-Jan-13 18:11pm    
"i don't need it to implement into the program ..... Just a task from college" and you have a class diagram already available what else you need?
Skfc 11-Jan-13 18:12pm    
Source code ......
Jibesh 11-Jan-13 18:19pm    
No I dont provide you the source code, I doubt any one here. But sure we are ready to help to any extent. let start some basic coding and and if you come with error your questions will be solved in a minute here i guess.

since you said its C++, just start doing this, I might help you completing this task but no source code.
1. Identify an editor where you can code C++ program, ( I guess you have Visual Studio)
2. You know how to define a class in C++?
3. You know how to define member variable in C++?

Just do the above steps and comeback
Skfc 11-Jan-13 18:23pm    
Ok its 2:00 am here in KSA . IN THE morning i will follow up this ....... I have both VS C++ express and code block
Jibesh 11-Jan-13 18:24pm    
take a deep nap and come back on your morning. will try to find an answer for you by that time.

Funnily, that isn't even an object model, it's a class model.

Create a class for each class in the diagram, add members for the attributes and methods, create inheritance relationships reflecting those in the diagram, ask your tutor why he's given you an invalid diagram (assuming its supposed to be UML) for the aggregations: the shared lines render them meaningless.

1. Does a house have (shared?) ref's to a flat and a plot?
2. Does a flat have a ref to a plot?

I'd question the diagram first. Its not valid UML, so it's actually impossible to correctly answer the assignment unless you make assumptions.

(Welcome to software development, sometimes (or normally) you have to refine the requirements before tackling a problem).
 
Share this answer
 
v2
Comments
Skfc 11-Jan-13 16:24pm    
Plz give at least simple example !!!!!
Sergey Alexandrovich Kryukov 11-Jan-13 18:10pm    
Read at least some basics first!!!
Cool down, you will get it. I think Rob knows better how to help you then you, frankly. Please, listen to the advice...
If you are trying to get all at once with minimal effort, you are risking to get nothing at all at the end.
—SA
Sergey Alexandrovich Kryukov 11-Jan-13 18:10pm    
Reasonable, a 5.
—SA
"We don't do homework for people - not because we feel like we're elite or too important, but because YOU won't learn anything if we do it for you. If you try to do it and have a problem with a particular part of the code, come back here and ask a question about THAT particular part of the code - NOT the entire application. If you don't learn these basic/essential skills now, you may as well decide on another career path before you put another - BETTER - programmer out of work simply because of your lower salary requirements."

Source[^]
 
Share this answer
 
Comments
Skfc 11-Jan-13 16:01pm    
This is not my career/ path ...... Someone asked me !!!!!!!
Skfc 11-Jan-13 16:02pm    
My friend challenges me
fjdiewornncalwe 11-Jan-13 17:13pm    
"My friend challenges me"
... with homework questions?

Maybe you forgot that you put "Just a task from college" in your question as well.
Skfc 11-Jan-13 17:43pm    
From college to my friend ...... He showed me and asked "if you think you are guniess then solve it "
Jibesh 11-Jan-13 18:08pm    
"if you think you are guniess then solve it " - then you have to solve it yourself by reading the available resources flooded on net. If we answered your question it might prove that you are not a genius and we dont want spoil that.

we take all the questions posted here very serious and pay close attentions to all the answers and reviews its not a joke for us.
What you shared in the image is a 'UML-Class Diagram' to know more about the representations used in a 'Class Diagram' check this[^]. they explained each notations with example in detail.

As I said I am not going to share you the source code rather I would explain how your classes are related based on the class diagram.

1.PropertyCategories is the base for Plot,Flat and House
2.Class Flat Contains instances of Plot (but not the parent)
3.Class House Contains instance of Plot (but not the parent)

Hope you get some idea about the implementation now.

I would recommend you to read the Class Diagram link carefully to know the meaning of
Quote:
(but not the parent)
statement.

Also as Rob said this Class diagram is incomplete it just shows relation between the classes but doesnt contains how many instances.so double check the diagram if you are going to do real program with this diagram
 
Share this answer
 
v2
Comments
Skfc 12-Jan-13 5:23am    
@jibesh check here i have created classes is it correct or not
http://www.codeproject.com/Questions/526657/C-2b-2bplusClassesplusfromplusUMLplusClassplusDiag
Jibesh 12-Jan-13 5:28am    
Yes. they are right. Please add the methods to the respective classes as defined in the class diagram. you can update questions if you want to modify your question.
Skfc 12-Jan-13 5:34am    
you mean the above my main question /...............
Jibesh 12-Jan-13 5:35am    
Yes. only if you have further doubts...
Skfc 12-Jan-13 5:37am    
K ....... Coding methods and soon i ill update the question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900