Assignment 2
Assignment 2
#include <iostream>
using namespace std;
class Person {
public:
string Name;
string PhoneNumber;
Person(){
cout <<"\n\nEnter Name of the person :";
cin >> Name;
cout <<"Enter Phone Number of the person :";
cin >> PhoneNumber;
}
};
class Academics: virtual public Person {
public:
string Degree;
float Percentage;
Academics(){
cout <<"Enter the Educational Qualification (Degree) of the person :";
cin >> Degree;
cout <<"Enter the Percentage obtained :";
cin >> Percentage;
}
};
class ExtraCirricular: virtual public Person {
public:
string Sport;
string Level;
ExtraCirricular(){
cout <<"Enter the Sports you play :";
cin >> Sport;
cout <<"Enter the level at which you play this game :";
cin >> Level;
}
};
class Biodata: public Academics, public ExtraCirricular {
public:
Biodata(){
cout <<"\n~~~~~ Biodata of the Person ~~~~~";
cout <<"\nName :"<<Name<<endl;
cout <<"Phone Number :"<<PhoneNumber<<endl;
cout <<"Degree :"<<Degree<<endl;
cout <<"Percentage :"<<Percentage<<endl;
cout <<"Sport :"<<Sport<<endl;
cout <<"Level :"<<Level<<endl;
cout <<"-----------------------------------------------";
}
};
int main(){
cout <<"Enter Biodata of person 1";
Biodata P1;
return 0;
}
Output