#include<conio.h>
#include<iostream.h>
class MFMother
{
double gold,properties;
public:
double togold,toopro;
void mgetdata()
{
cout<<"\nEnter GMother's Details ";
cout<<"\nEnter Gold in Kg :";cin>>gold;
gold = gold*30200;
togold=gold;
cout<<"\nEnter Properties : ";cin>>properties;
toopro=properties;
}
};
class MFFather
{
double cash;
double properties;
public:
double topro,tocash;
void fgetdata()
{
cout<<"\nEnter MFather's Details ";
cout<<"\nEnter Cash : ";cin>>cash;
tocash=cash;
cout<<"Enter Properties : ";cin>>properties;
topro=properties;
}
};
class Mother:public MFMother,public MFFather
{
double goldx,cashx;
double propertiesx;
public:
double mgold,mcash,mpro;
void getmother()
{
cout<<"\nEnter Mothers Details ";
cout<<"\nEnter Gold in Kg ";cin>>goldx;
goldx=goldx*30200;
goldx=goldx+togold;
cashx=tocash;
mgold=goldx;
mcash=cashx;
cout<<"\nEnter Properties ";cin>>propertiesx;
propertiesx=propertiesx+topro;
propertiesx=propertiesx+toopro;
mpro=propertiesx;
}
};
class GMother
{
double gold,properties;
public:
double togold,toopro;
void gmgetdata()
{
cout<<"\nEnter GMother's Details ";
cout<<"\nEnter Gold in Kg :";cin>>gold;
gold = gold*30200;
togold=gold;
cout<<"\nEnter Properties : ";cin>>properties;
toopro=properties;
}
};
class GFather
{
double cash;
double properties;
public:
double tocash,topro;
void gfgetdata()
{
cout<<"\nEnter GFather's Details ";
cout<<"\nEnter Cash : ";cin>>cash;
tocash=cash;
cout<<"Enter Properties : ";cin>>properties;
topro=properties;
}
};
class Father:public GMother,public GFather
{
double goldxx,cashxx;
double propertiesxx;
public:
double fgold,fpro,fcash;
void getfather()
{
cout<<"\nEnter Father's Details ";
cout<<"\nEnter Cash ";cin>>cashxx;
fgold=0;
cashxx=cashxx+tocash;
fcash=cashxx;
cout<<"\nEnter Properties ";cin>>propertiesxx;
propertiesxx=propertiesxx+topro;
propertiesxx=propertiesxx+toopro;
fpro=propertiesxx;
}
};
class Child:public Mother,public Father
{
double tgold,tcash,tpro;
public:
void showinfo()
{
tgold=mgold+fgold;
tcash=mcash+fcash;
tpro=mpro+fpro;
cout<<"\n\t\tChild's Properties ";
cout<<"\n\t Total Gold = "<<tgold;
cout<<"\n\t Total Cash = "<<tcash;
cout<<"\n\t Total Properties = "<<tpro;
}
};
int main()
{
clrscr();
cout<<"\n\n\t Family Total Properties ";
Child Anisha;
Anisha.mgetdata();
Anisha.fgetdata();
Anisha.gmgetdata();
Anisha.gfgetdata();
Anisha.getmother();
Anisha.getfather();
Anisha.showinfo();
getch();
return 0;
}
#include<iostream.h>
class MFMother
{
double gold,properties;
public:
double togold,toopro;
void mgetdata()
{
cout<<"\nEnter GMother's Details ";
cout<<"\nEnter Gold in Kg :";cin>>gold;
gold = gold*30200;
togold=gold;
cout<<"\nEnter Properties : ";cin>>properties;
toopro=properties;
}
};
class MFFather
{
double cash;
double properties;
public:
double topro,tocash;
void fgetdata()
{
cout<<"\nEnter MFather's Details ";
cout<<"\nEnter Cash : ";cin>>cash;
tocash=cash;
cout<<"Enter Properties : ";cin>>properties;
topro=properties;
}
};
class Mother:public MFMother,public MFFather
{
double goldx,cashx;
double propertiesx;
public:
double mgold,mcash,mpro;
void getmother()
{
cout<<"\nEnter Mothers Details ";
cout<<"\nEnter Gold in Kg ";cin>>goldx;
goldx=goldx*30200;
goldx=goldx+togold;
cashx=tocash;
mgold=goldx;
mcash=cashx;
cout<<"\nEnter Properties ";cin>>propertiesx;
propertiesx=propertiesx+topro;
propertiesx=propertiesx+toopro;
mpro=propertiesx;
}
};
class GMother
{
double gold,properties;
public:
double togold,toopro;
void gmgetdata()
{
cout<<"\nEnter GMother's Details ";
cout<<"\nEnter Gold in Kg :";cin>>gold;
gold = gold*30200;
togold=gold;
cout<<"\nEnter Properties : ";cin>>properties;
toopro=properties;
}
};
class GFather
{
double cash;
double properties;
public:
double tocash,topro;
void gfgetdata()
{
cout<<"\nEnter GFather's Details ";
cout<<"\nEnter Cash : ";cin>>cash;
tocash=cash;
cout<<"Enter Properties : ";cin>>properties;
topro=properties;
}
};
class Father:public GMother,public GFather
{
double goldxx,cashxx;
double propertiesxx;
public:
double fgold,fpro,fcash;
void getfather()
{
cout<<"\nEnter Father's Details ";
cout<<"\nEnter Cash ";cin>>cashxx;
fgold=0;
cashxx=cashxx+tocash;
fcash=cashxx;
cout<<"\nEnter Properties ";cin>>propertiesxx;
propertiesxx=propertiesxx+topro;
propertiesxx=propertiesxx+toopro;
fpro=propertiesxx;
}
};
class Child:public Mother,public Father
{
double tgold,tcash,tpro;
public:
void showinfo()
{
tgold=mgold+fgold;
tcash=mcash+fcash;
tpro=mpro+fpro;
cout<<"\n\t\tChild's Properties ";
cout<<"\n\t Total Gold = "<<tgold;
cout<<"\n\t Total Cash = "<<tcash;
cout<<"\n\t Total Properties = "<<tpro;
}
};
int main()
{
clrscr();
cout<<"\n\n\t Family Total Properties ";
Child Anisha;
Anisha.mgetdata();
Anisha.fgetdata();
Anisha.gmgetdata();
Anisha.gfgetdata();
Anisha.getmother();
Anisha.getfather();
Anisha.showinfo();
getch();
return 0;
}
No comments:
Post a Comment