www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

idea solution of cs304 3 assignment

//IDEA SOLUTIO N OF CS304 3
#include<iostream.h>
class property_cat
{
private:
char society[20];
int area;
public:
property_cat()
{
area=0;
}
~property_cat()
{
}
char setsociety(char c[])
{
strcpy(society,c);
}
char* getsociety()
{
return society;
}
int setarea(int a)
{
area=a;
}
int getarea()
{
return area;
}

};
class Plot:public property_cat
{
private:
int plot;
public:
Plot()
{
}
~Plot()
{
}
int setplot(int a)
{
plot=a;
}
int getplot()
{
return plot;
}
int iscorner()
{
}
int isalloted()
{
}
int isdeveloped()
{
}
};
class House:public property_cat
{
private:
int house;
Plot *a;
public:
House()
{
house=0;
}
~House()
{
}
int sethouse(int a)
{
house=a;
}
int gethouse()
{
return house;
}
int isoccupied()
{
}
};
class Flat:public property_cat
{
private:
int flat;
Plot *a;
public:
Flat()
{
flat=0;

}
~Flat()
{

}
int setflat(int a)
{
flat=a;
}
int getflat()
{
return flat;
}
int isoccupied()
{
}
};

main()
{
cout"*****this assignment need no output*****\n";
system("pause");
}

Views: 1722

Replies to This Discussion

yaar Please Correct Soution post kr do Time bohat short hai phir modify bhi krna hai tens lagi hui hai kahen say koi samaj nahi lag rahi

ash ap ne is step ko kahan consider kiya h????

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.

• 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.
• isCornerPlot () will check whether current plot is corner plot or not. You can take input from user in this regard.
• 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.
• 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.

un sb function ka kuch nhi  kara un me bhi to koi na koi kam ho raha ha to bhi is ka bhi bat do ya  kase kam ma use nhi hon gye

Syed Faizan ul Hassan yeh correct solution hai kaya

i know in sab function main ap just

cout"Is Developed Plot? Y/N ";
char isdevelop;
cin>>isdevelop;

if(isdevelop=='Y' || isdevelop=='y')
{
return true;
}

else
{
return false;

add kar do baqi main thing relation hain wo meri assign main 100% thk hai

yr yeh assignment c++ k software mein b lika skta hain plz reply

Asif bhya banani hi Devc++ mn hy

/*
**********************************************
SOLUTION BY VUSTUDENTS
**********************************************

+---------------------------------------------------------------------+
-> Property Category has Inheritance Relation with Plot, Flat & House
-> Plot has aggregate relation with Flat and House
-> Flat & House also have aggregate relation
+---------------------------------------------------------------------+
*/

#include<iostream>
#include<string.h>
using namespace std;

class PropertyCategories
{
private:
string SocietyName;
int Area;
public:
PropertyCategories()
{
}
void setArea( )
{
int tempArea;
cout"Enter Area ";
cin>>tempArea;
Area=tempArea;
}
int getArea()
{
return Area;
}

void setsocietyname()
{
string tempName;
cout"Enter Socity Name ";
cin>>tempName;
SocietyName=tempName;
}
string getsocietyname()
{
return SocietyName;
}
~PropertyCategories()
{

};

/*********************
PLOT CLASS
*********************/

class Plot:PropertyCategories
{
private:
int Plotno;
public:
Plot()
{
}

void setPlotno()
{
int tmp_plot_no;
cout"Enter Plot Number: ";
cin>>tmp_plot_no;
Plotno=tmp_plot_no;
}
int getPlotno()
{
return Plotno;

bool isPlotallotted()
{
cout"Is Plotted alloted ? Y/N ";
char isAlloted;
cin>>isAlloted;
if(isAlloted=='Y' || isAlloted=='y')
{
return true;
}

else
{
return false;
}

}
bool isCornerPlot()
{
cout"Is Corner ? Y/N ";
char isCorner;
cin>>isCorner;

if(isCorner=='Y' || isCorner=='y')
{
return true;
}

else
{
return false;
}

}
bool isDeveloped()
{
cout"Is Developed Plot? Y/N ";
char isdevelop;
cin>>isdevelop;

if(isdevelop=='Y' || isdevelop=='y')
{
return true;
}

else
{
return false;

}
~Plot()
{
}
};

/*********************
FLAT CLASS
*********************/

class Flat:PropertyCategories
{
private:
Plot *p;
int FlatNo;
public:

bool isCornerPlot()
{
p->isCornerPlot();

void setFlatNo()
{
int tmp_FlatNo;
cout"Enter Flat Number ";
cin>>tmp_FlatNo;
FlatNo=tmp_FlatNo;
}
int getFlatNo()
{
return FlatNo;
}

bool isOccupied()
{
cout"Is Occupied ? Y/N ";
char isocp;
cin>>isocp;

if(isocp=='Y' || isocp=='y')
{
return true;
}

if(isocp=='N' || isocp=='n')
{
return false;

}

};

/*********************
HOUSE CLASS
*********************/

class House:PropertyCategories
{
private:
Plot *p1;
Flat *flat_pointer;
int HouseNo;
public:

bool isCornerPlot()
{
p1->isCornerPlot();

void setHouseNo()
{
int tmp_HouseNo;
cout"Enter House Number ";
cin>>tmp_HouseNo;
HouseNo=tmp_HouseNo;
}
int getHouseNo()
{
return HouseNo;
}

bool isOccupied()
{
flat_pointer->isOccupied();
}

};

main()

cout"\nPlot Class is starting....\n";
Plot pl;
pl.setPlotno();

if(pl.isPlotallotted()==false)
{
cout"\nPlot No : "pl.getPlotno()"\nThis plot is alloted to you.\n";
}

else
{
cout"\nPlot is Alloted so you can't use it for Rent/Purchase..\n";
}

cout"\n---------------------------------------\n";
cout"\nFlat Class is starting....\n";
Flat fl;
fl.setFlatNo();

if(fl.isOccupied()==false)
{
cout"\nFlat is Not Occupied.....\n";
if(fl.isCornerPlot())
{
cout"\nThis Flat is a corner Flat \n";
}
else
{
cout"\nThis Flat is a Not a corner Flat \n";
}

}
else
{
cout"\nFlat is Occupied.....\n";
}

cout"\n---------------------------------------\n";
cout"\nHouse Class is starting....\n";
House hl;
hl.setHouseNo();

if(hl.isOccupied()==false)
{
cout"\nHouse is Not Occupied.....\n";
if(hl.isCornerPlot())
{
cout"\nThis House is a corner House \n";
}
else
{
cout"\nThis House is a Not a corner House \n";
}

}
else
{
cout"\nHouse is Occupied.....\n";
}

system("pause");
}

#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
class House;
class Room
{ public: Room() { };
static void createRoom_v(Room* (&room), House* hse,
char* name) { room = new Room(hse, name);
} Room(House* hse, char* myName)
{ cout"PakistaniCitizens\n";
myHse_p = hse;
if(NULL != myHse_p)
{ name_p = new char(sizeof(strlen(myName)));
name_p = myName;
}
else { cout"Please enter the age of the citizen\n";
} };
~Room() { cout"PakistaniCitizens\n";
myHse_p = NULL;
delete (name_p);
};
void disp() {coutname_p;
cout"\n";
} static void initList_v(Room *(& roomsList_p)[3])
{ roomsList_p[3] = new Room[3];
} private: House * myHse_p;
char * name_p;};
class House{ public: House(char *myName) { cout"PakistaniCitizens\n";
name_p = new char(sizeof(strlen(myName)));;
name_p = myName;
Room::initList_v(roomsList_p);
Room* myRoom;
Room::createRoom_v(myRoom, this, "name");
roomsList_p[0] = myRoom;
Room::createRoom_v(myRoom, this, "age");
roomsList_p[1] = myRoom;
Room::createRoom_v(myRoom, this, "CNIC No");
roomsList_p[2] = myRoom;
} ~House() { cout"PakistaniCitizens\n";
unsigned int i;
cout"Eligible for vote cast...\n";
for(i=0; i<3; ++i) {
if(roomsList_p[i] != NULL)
{ delete (roomsList_p[i]);
} }
delete [] roomsList_p;
delete (name_p);
} void disp()
{ cout"\n\nPakistaniCitizens :"name_p;
if(roomsList_p != NULL) { unsigned int i;
cout"\n\nVotersList...\n";
for(i=0; i<3; ++i) { if(NULL != roomsList_p[i])
{ roomsList_p[i]->disp();
} } cout"\n\n"; } } private:
char* name_p;
Room* roomsList_p[3];};
int main(){ cout"\nExample of Composition Relationship\n";
cout"-----------------------------------------\n\n";
House hse("data members");
cout"\n\nPakistaniCitizens...\n";
hse.disp();
cout"Age is less than 18...\n";
return(0);
system("pause");
}

Tariq Bhai in dono main eror hy. plz koe correct solution upload kr dy.

jaha jaha cout hy waha sign dal do output wala

Maha. its wrkng bs thra dhyan dn r errors khtm krn.

Top Trends

1

2

3

4

Mani Siddiqui

5

------------------------------------

Latest Activity

1 hour ago
Ishrat Shaheen joined + M.Tariq Malik's group

CS607 Artificial Intelligence

2 hours ago
MUHAMMAD USMAN added a discussion to the group CS101 Introduction to Computing

5 hours ago
Pizza updated their profile
14 hours ago
naveed asmat mirza and Zain Arshad joined + M.Tariq Malik's group

CS304 Object Oriented Programming

15 hours ago
15 hours ago
Asad waqas joined + M.Tariq Malik's group

15 hours ago
16 hours ago