Add screenshots of outputs as well Execute the following example and write a comment after each line of code. In result print output of code. #include #include using namespace std; class Date {public: Date() {month=1;  day=1;  year=1990; } Date(int m,int d, int y)   { month=m; day=d; year=y; } void set() { int d,m,y; cout<<"Enter day: "; cin>>d; cout<<"Enter month: "; cin>>m; cout<<"Enter year: "; cin>>y;                                                 month=m;                                                 day=d;                                                 year=y;                                 }                                 void print()                                 {                                                 cout<>m;                                                 cout<<"Enter father name: ";                                                 cin>>f;                                                 mother=m;                                                 father=f;                                 }                                 void print()                                 {                                                 cout<<"father name: "<>eid;                                                 ID=eid;                                                 cout<<"          Enter birth date information"<p=p;                                           }                                 void print()                                 {                                                 cout<<"Employee ID: "<>e;                 Employee* e1=new Employee[e];                 Parent p;                 Date bd,hd;                 for(int i=0;i

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

PROGRAMMING LANGUAGE: C++

 

Add screenshots of outputs as well

Execute the following example and write a comment after each line of code. In result print output of code.

#include<iostream>

#include<string>

using namespace std;

class Date

{public:

Date()

{month=1;

 day=1;

 year=1990; }

Date(int m,int d, int y)

  {

month=m;

day=d;

year=y; }

void set()

{ int d,m,y;

cout<<"Enter day: ";

cin>>d;

cout<<"Enter month: ";

cin>>m;

cout<<"Enter year: ";

cin>>y;

                                                month=m;

                                                day=d;

                                                year=y;

                                }

                                void print()

                                {

                                                cout<<day<<"-"<<month<<"-"<<year;

                                }

                               

                private:

                                int month;

                                int day;

                                int year;

};

class Parent

{

                public:

                                Parent(string m="hawa",string f="adam")

                                {

                                                mother=m;

                                                father=f;

                                }

                                void set()

                                {

                                                string m; string f;

                                                cout<<"Enter mother name: ";

                                                cin>>m;

                                                cout<<"Enter father name: ";

                                                cin>>f;

                                                mother=m;

                                                father=f;

                                }

                                void print()

                                {

                                                cout<<"father name: "<<father<<" mother name: "<<mother;

                                }

                private:

                                string mother;

                                string father;

                               

};

class Employee

{

                public:

                                Employee()

                                {

                                                ID=1;

                                                Date d1;

                                                birthdate=d1;

                                                Date d2;

                                                hiredate=d2;

                                }

                                Employee(int eID,Datebd,Datehd)

                                {

                                                ID=eID;

                                                birthdate=bd;

                                                hiredate=hd;

                                }

                                void set(Date bd, Date hd,Parent p)

                                {

                                                int eid;

                                                cout<<"Enter ID of Employee: ";

                                                cin>>eid;

                                                ID=eid;

                                                cout<<"          Enter birth date information"<<endl;

                                                bd.set();

                                                birthdate=bd;

                                                cout<<"          Enter hire date information"<<endl;

                                                hd.set();

                                                hiredate=hd;

                                                p.set();

                                                this->p=p;          

                                }

                                void print()

                                {

                                                cout<<"Employee ID: "<<ID

                                                <<" birthDate ";birthdate.print();

                                                cout<<" hireDate ";hiredate.print();

                                                cout<<" ";

                                                p.print();

                                                cout<<endl;

                                }

                private:

                int ID;

                Date birthdate;

                Date hiredate;

                Parent p;            

};

int main()

{

                int e;

                cout<<"Enter number of emplyees: ";

                cin>>e;

                Employee* e1=new Employee[e];

                Parent p;

                Date bd,hd;

                for(int i=0;i<e;i++)

                                e1[i].set(bd,hd,p);                         

               

 

                for(int i=0;i<e;i++)

                                e1[i].print();

                return 0;

}

Expert Solution
steps

Step by step

Solved in 2 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