Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ write a class called resident as a base class, student, and grad student as

ID: 3913893 • Letter: C

Question

C++

write a class called resident as a base class, student, and grad student as derived classes to explore the properties of multiples inheritance according to the diagram shown

Write a class called resident as a base class, student and gradstudent as derived classes to explore the properties of multiple inheritance according to the diagram shown below: resident name soc num setdata showdata student dept_name student nuum setdata showdata gradstudent prog_name supervisor setdata showdata Write a driver program which declares objects to each of theclasses and produces outputs for every class, which are resident, student, and gradstudent.

Explanation / Answer

#include<iostream>

using namespace std;

class resident

{

char name[50];

int soc_num;

public:

void setdata()

{

cout << " Enter name";

cin >> name;

cout << " Enter soc_num";

cin >> soc_num;

}

void showdata()

{

cout << " name:" << name;

cout << " soc_num:"<< soc_num;

}

};

class student : public resident

{

char dept_name[50];

int student_num;

public:

void setdata()

{

resident :: setdata();

cout << " Enter dept_name";

cin >> dept_name;

cout << " Enter student_num";

cin >> student_num;

}

void showdata()

{

resident::showdata();

cout << " dept_name:" << dept_name;

cout << " student_num:" << student_num;

}

};

class gradstudent : public resident

{

char prog_name[50];

char supervisor[30];

public:

void setdata()

{

resident::setdata();

cout << " Enter prog_name";

cin >> prog_name;

cout << " Enter supervisor";

cin >> supervisor;

}

void showdata()

{

resident::showdata();

cout << " prog_name:" << prog_name;

cout << " supervisor:" << supervisor;

}

};

int main()

{

student s1;

gradstudent g1;

s1.setdata();

cout << " data for student";

g1.setdata();

cout << " data for gradstudent ";

s1.showdata();

cout <<" data of student";

g1.showdata();

cout << " data of gradstudent";

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote