Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
2.7 kB
2
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

// Personal Record Class
class Personal_Record {
protected:
    string name, address, email, phone_no;

public:
    void accept_personal_data() {
        cout << "Enter Name: ";
        getline(cin, name);
        cout << "Enter Address: ";
        getline(cin, address);
        cout << "Enter Email: ";
        getline(cin, email);
        cout << "Enter Phone Number: ";
        getline(cin, phone_no);
    }
};

// Professional Record Class
class Professional_Record {
protected:
    string cname, caddress, cphone_no;
    int exp;

public:
    void accept_professional_data() {
        cout << "Enter Company Name: ";
        getline(cin, cname);
        cout << "Enter Company Address: ";
        getline(cin, caddress);
        cout << "Enter Company Phone Number: ";
        getline(cin, cphone_no);
        cout << "Enter Years of Experience: ";
        cin >> exp;
        cin.ignore(); // Ignore newline character after reading integer input
    }
};

// Academic Record Class
class Academic_Record {
protected:
    string qualification, university_name;
    float percentage;
    int passing_year;

public:
    void accept_academic_data() {
        cout << "Enter Qualification: ";
        getline(cin, qualification);
        cout << "Enter University Name: ";
        getline(cin, university_name);
        cout << "Enter Percentage: ";
        cin >> percentage;
        cout << "Enter Passing Year: ";
        cin >> passing_year;
        cin.ignore(); // Ignore newline character after reading integer input
    }
};

// Bio-data Class using Multiple Inheritance
class BioData : public Personal_Record, public Professional_Record, public Academic_Record {
public:
    void accept() {
        accept_personal_data();
        accept_professional_data();
        accept_academic_data();
    }

    void display() {
        cout << "\n------ Employee Bio-Data ------\n";
        cout << "Name: " << name << endl;
        cout << "Address: " << address << endl;
        cout << "Email: " << email << endl;
        cout << "Phone Number: " << phone_no << endl;
        cout << "Company Name: " << cname << endl;
        cout << "Company Address: " << caddress << endl;
        cout << "Company Phone Number: " << cphone_no << endl;
        cout << "Experience: " << exp << " years" << endl;
        cout << "Qualification: " << qualification << endl;
        cout << "University Name: " << university_name << endl;
        cout << "Percentage: " << percentage << "%" << endl;
        cout << "Passing Year: " << passing_year << endl;
    }
};

int main() {
    BioData employee;
    employee.accept();
    employee.display();
    return 0;
}