//i need the explanation of the below c++ code in 30 minutes. #include using namespace std; class University //class (University) definition { // encapsulation private: static string Name,location; //Static variables declaration public: static void getdata() //Static function definition { cout<<"Please Enter Name of University : "; getline(cin,Name); Check: if(Name=="CITY UNIVERSITY"||Name=="city university") //input validation { cout<<"Please Enter Location of University : "; getline(cin,location); Chec: if(location=="DALAZAK ROAD PESHAWAR"||location=="dalazak road peshawar") { } else { for(bool itrue=false;itrue=true;itrue++) { cout<<"Please Enter Valid location of University : "; getline(cin,location); goto Chec; } } } else { for(bool istrue=false;istrue=true;istrue++) { cout<<"Please Enter Valid Name of University : "; getline(cin,Name); goto Check; } } } static void Display() // another static function definition { cout<<"University Name is : "<>age; cin.ignore(); cout<<"Please Enter Your Gender : "; getline(cin,Gender); cout<<"Please Enter Your Department : "; getline(cin,Department); } virtual void display() // Late binding { cout<<"Your Name is : "<Level=Level; this->Semester=Semester; } void getdata() // definition of member function { University::getdata(); person::getdata(); cout<<"Please Enter Your Education Level : "; getline(cin,Semester); cout<<"Please Enter Your Semester Number : "; getline(cin,Level); } void display() // defintion of member function { University::Display(); person::display(); cout<<"Education Level is : "<salary=salary; } void display() //member function definition { University::Display(); person::display(); cout<<"Specialization Subject is : "<getdata(); cout<<"\t.............................."<display(); cout<>sa; e.getdata(sa); cout<<"\t.............................."<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

//i need the explanation of the below c++ code in 30 minutes.

#include<iostream>
using namespace std;

class University //class (University) definition
{
// encapsulation
private:
static string Name,location; //Static variables declaration
public:
static void getdata() //Static function definition
{
cout<<"Please Enter Name of University : ";
getline(cin,Name);
Check:
if(Name=="CITY UNIVERSITY"||Name=="city university") //input validation
{
cout<<"Please Enter Location of University : ";
getline(cin,location);
Chec:
if(location=="DALAZAK ROAD PESHAWAR"||location=="dalazak road peshawar")
{
}
else
{
for(bool itrue=false;itrue=true;itrue++)
{
cout<<"Please Enter Valid location of University : ";
getline(cin,location);
goto Chec;
}
}
}
else
{
for(bool istrue=false;istrue=true;istrue++)
{
cout<<"Please Enter Valid Name of University : ";
getline(cin,Name);
goto Check;
}
}
}
static void Display() // another static function definition
{
cout<<"University Name is : "<<Name<<endl;
cout<<"Location is : "<<location<<endl;
}
};

// static variables initialization
string University::Name="";
string University ::location="";

class person // class (person) definition
{
private:
string Name,Gender,Department; //variables
int age; //declaration

public:
virtual void getdata() // Late binding
{
cout<<"Please Enter Your Name : ";
getline(cin,Name);
cout<<"Please Enter Your age : ";
cin>>age;
cin.ignore();
cout<<"Please Enter Your Gender : ";
getline(cin,Gender);
cout<<"Please Enter Your Department : ";
getline(cin,Department);
}
virtual void display() // Late binding
{
cout<<"Your Name is : "<<Name<<endl;
cout<<"Your age is : "<<age<<endl;
cout<<"Your Gender is : "<<Gender<<endl;
cout<<"Your Department is : "<<Department<<endl;
}
};

class student: public person, public University // (student child_class definition) it derived from two base classes
// so it is called multiple inheritance
{
private:
string Level,Semester; // data members declaration
public:
student() // default constructor
{

}
student(string Level,string Semester) // parameterized constructor
{
this->Level=Level;
this->Semester=Semester;
}
void getdata() // definition of member function
{
University::getdata();
person::getdata();
cout<<"Please Enter Your Education Level : ";
getline(cin,Semester);
cout<<"Please Enter Your Semester Number : ";
getline(cin,Level);
}
void display() // defintion of member function
{
University::Display();
person::display();
cout<<"Education Level is : "<<Semester<<endl;
cout<<"Semester Number is : "<<Level<<endl;
}
};

class teachers: public person, public University // definition of (teacher Child_Class) it derived from two
// base classes so its called multiple inheritance.
{
private:
// data members declaration
int salary;
string specialization;
public:

//polymorphism
void getdata() // member function definition
{
University::getdata();
person::getdata();
cout<<"Please Enter Your Specialization Subject : ";
getline(cin,specialization);

}
void getdata(int salary)
{
this->salary=salary;
}
void display() //member function definition
{
University::Display();
person::display();
cout<<"Specialization Subject is : "<<specialization<<endl;
cout<<"Sallary is : "<<salary<<endl;
}
};
int main()
{
person *p = new student;
student s("","");
teachers e;

cout<<"\t======================"<<endl;
cout<<"\t= Student Enter Data ="<<endl;
cout<<"\t======================"<<endl<<endl;
p->getdata();
cout<<"\t.............................."<<endl;
cout<<"\t. Displaying data of Student ."<<endl;
cout<<"\t.............................."<<endl<<endl;
p->display();

cout<<endl<<"\t======================"<<endl;
cout<<"\t= Teacher Enter Data ="<<endl;
cout<<"\t======================"<<endl<<endl;
e.getdata();
int sa;
cout<<"Please Enter Your Salary : ";
cin>>sa;
e.getdata(sa);

cout<<"\t.............................."<<endl;
cout<<"\t. Displaying data of Teacher ."<<endl;
cout<<"\t.............................."<<endl<<endl;
e.display();
return 0;
}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY