create employee biodata using c++
/*
Create employee biodata 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 biodata using multiple inheritance using C++.
*/
#include<iostream>
using namespace std;
class personal
{
public:
char name[20];
int age;
int date,month,year;
char gender;
personal()
{
cout<<" Enter name :";
cin>>name;
cout<<" \n Enter age :";
cin>>age;
cout<<" \n Enter date of birth";
cin>>date>>month>>year;
cout<<"\n Enter gender(F/M)";
cin>>gender;
}
};
class professional
{
public:
int id;
int d,m,y;
professional()
{
cout<<"\n Enter ID number";
cin>>id;
cout<<"\n Enter date of joining";
cin>>d>>m>>y;
}
};
class academic
{
public:
char edu[20];
char branch[20];
academic()
{
cout<<"\n Enter education";
cin>>edu;
cout<<"\n Enter branch";
cin>>branch;
}
};
class all:public personal,public professional,public academic
{
public:
all()
{
cout<<"\n\tBIO DATA\n";
cout<<"Personal data:";
cout<<"\nname is "<<name<<"\n age is "<<age<<"\n Date of birth "<<date<<"/"<<month<<"/"<<year;
cout<<"\n\nprofessional data:\n";
cout<<"ID is "<<id<<"\n date of joining "<<d<<"/"<<m<<"/"<<y;
cout<<"\n\nacademic data:\n";
cout<<"Education is "<<edu<<"\n branch is "<<branch;
}
};
int main()
{
all obj;
return 0;
}
output-
Enter name :xyz
Enter age :18
Enter date of birth 12 6 1999
Enter gender(F/M)M
Enter ID number 321
Enter date of joining 20 4 2018
Enter education BE
Enter branch comp
BIO DATA
Personal data:
name is xyz
age is 18
Date of birth 12/6/1999
professional data:
ID is 321
date of joining 20/4/2018
academic data:
Education is BE
branch is comp
Create employee biodata 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 biodata using multiple inheritance using C++.
*/
#include<iostream>
using namespace std;
class personal
{
public:
char name[20];
int age;
int date,month,year;
char gender;
personal()
{
cout<<" Enter name :";
cin>>name;
cout<<" \n Enter age :";
cin>>age;
cout<<" \n Enter date of birth";
cin>>date>>month>>year;
cout<<"\n Enter gender(F/M)";
cin>>gender;
}
};
class professional
{
public:
int id;
int d,m,y;
professional()
{
cout<<"\n Enter ID number";
cin>>id;
cout<<"\n Enter date of joining";
cin>>d>>m>>y;
}
};
class academic
{
public:
char edu[20];
char branch[20];
academic()
{
cout<<"\n Enter education";
cin>>edu;
cout<<"\n Enter branch";
cin>>branch;
}
};
class all:public personal,public professional,public academic
{
public:
all()
{
cout<<"\n\tBIO DATA\n";
cout<<"Personal data:";
cout<<"\nname is "<<name<<"\n age is "<<age<<"\n Date of birth "<<date<<"/"<<month<<"/"<<year;
cout<<"\n\nprofessional data:\n";
cout<<"ID is "<<id<<"\n date of joining "<<d<<"/"<<m<<"/"<<y;
cout<<"\n\nacademic data:\n";
cout<<"Education is "<<edu<<"\n branch is "<<branch;
}
};
int main()
{
all obj;
return 0;
}
output-
Enter name :xyz
Enter age :18
Enter date of birth 12 6 1999
Enter gender(F/M)M
Enter ID number 321
Enter date of joining 20 4 2018
Enter education BE
Enter branch comp
BIO DATA
Personal data:
name is xyz
age is 18
Date of birth 12/6/1999
professional data:
ID is 321
date of joining 20/4/2018
academic data:
Education is BE
branch is comp
Comments
Post a Comment