Create employee bio-data using following classes i) Personal record ii)Professional record iii)Academic record
Assume appropriate data members and member function to accept required
data & print bio-data. Create bio-data using multiple inheritance using C++.
OUTPUT OF THE PROGRAM |
#include<iostream>
#include<iomanip>
using namespace std;
class personal
{
protected:
char name[10],add[10],dob[10];
int mob;
char bg[5],gender[6];
public:
void getdata()
{
cout<<"Enter your Name :";
cin>>name;
cout<<"Enter your Current Address :";
cin>>add;
cout<<"Enter your Mobile No. :";
cin>>mob;
cout<<"Enter your Date of Birth :";
cin>>dob;
cout<<"Enter your Blood group :";
cin>>bg;
cout<<"Enter your Gender :";
cin>>gender;
}
};
class professional
{
protected:
char post[10],compname[10],dept[10];
int salary;
public:
void accept()
{
cout<<"Enter your Company Name :";
cin>>compname;
cout<<"Enter your Department :";
cin>>dept;
cout<<"Enter your Post Name :";
cin>>post;
cout<<"Enter your Salary :";
cin>>salary;
}
};
class academic
{
protected:
char qua1[10],qua2[10];
int score1,score2;
char sport[10];
public:
void data()
{
cout<<"Enter your highest Qualification :";
cin>>qua1;
cout<<"Enter your second highest Qualification :";
cin>>qua2;
cout<<"Enter your highest Qualification Score :";
cin>>score1;
cout<<"Enter your second highest Qualification Score :";
cin>>score2;
cout<<"Are you played any sport :";
cin>>sport;
}
};
class biodata:public personal, public professional,public academic
{
public:
void display()
{
cout<<"\n********************BIODATA************************\n";
cout<<"\n********************Personal Data********************\n";
cout<<setw(10)<<"Name"<<setw(10)<<"ADD"<<setw(10)<<"Mob no"<<setw(10)<<"DOB"<<setw(10)<<"BG"<<setw(10)<<"Gender";
cout<<"\n"<<setw(10)<<name<<setw(10)<<add<<setw(10)<<mob<<setw(10)<<dob<<setw(10)<<bg<<setw(5)<<gender;
cout<<"\n*******************Professional Details****************\n";
cout<<setw(10)<<"Comp Name"<<setw(10)<<"Dept"<<setw(10)<<"Post"<<setw(10)<<"Salary";
cout<<"\n"<<setw(10)<<compname<<setw(10)<<dept<<setw(10)<<post<<setw(10)<<salary;
cout<<"\n*******************Academic Details *******************\n";
cout<<setw(5)<<"1st high Qua. "<<setw(5)<<"2nd high Qua. "<<setw(5)<<"1st high Qua.score "<<setw(5)<<"2nd high Qua.score "<<setw(5)<<"Sport";
cout<<"\n"<<setw(10)<<qua1<<setw(10)<<qua2<<setw(13)<<score1<<setw(23)<<score2<<setw(15)<<sport;
}
};
int main()
{
biodata b;
b.getdata();
b.accept();
b.data();
b.display();
cout<<"\n\n";
return 0;
}
**********OUTPUT*************
/*
Enter your Name :Sushil
Enter your Current Address :Nashik
Enter your Mobile No. :123456
Enter your Date of Birth :2Jan
Enter your Blood group :B+
Enter your Gender :M
Enter your Company Name :X
Enter your Department :X
Enter your Post Name :X
Enter your Salary :75000
Enter your highest Qualification :ABC
Enter your second highest Qualification :XYZ
Enter your highest Qualification Score :85
Enter your second highest Qualification Score :95
Are you played any sport :Yes
********************BIODATA************************
********************Personal Data********************
Name ADD Mob no DOB BG Gender
Sushil Nashik 123456 2Jan B+ M
*******************Professional Details****************
Comp Name Dept Post Salary
X X X 75000
*******************Academic Details *******************
1st high Qua. 2nd high Qua. 1st high Qua.score 2nd high Qua.score Sport
ABC XYZ 85 95 Yes
*/
For more such posts click the link:-http://svencrai.com/G8W