write coments infront of wery line of code.
#include#includeusing 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="">< "-"=""><>}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:="" "=""><>}private:string mother;string father;};class Employee{public:Employee(){ID = 1;Date d1;birthdate = d1;Date d2;hiredate = d2;}Employee(int eID, Date bd, Date hd){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"=""><>bd.set();birthdate = bd;cout < "="" enter="" hire="" date="" information"=""><>hd.set();hiredate = hd;p.set();this->p = p;}void print(){cout < "employee="" id:="" "=""><>< "="" birthdate="" ";="">cout < "="" hiredate="" ";="">cout < "="">p.print();cout <>}private:int ID;Date birthdate;Date hiredate;Parent p;};int main(){int e;cout < "enter="" number="" of="" emplyees:="">cin >> e;Employee e1[10];Parent p;Date bd, hd;for (int i = 0; i < e;="">e1[i].set(bd, hd, p);for (int i = 0; i < e;="">e1[i].print();return 0;}
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="">< "-"=""><>}
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:="" "=""><>}private:string mother;string father;
};class Employee{public:Employee(){ID = 1;Date d1;birthdate = d1;Date d2;hiredate = d2;}Employee(int eID, Date bd, Date hd){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"=""><>bd.set();birthdate = bd;cout < "="" enter="" hire="" date="" information"=""><>hd.set();hiredate = hd;p.set();this->p = p;}void print(){cout < "employee="" id:="" "=""><>< "="" birthdate="" ";="">cout < "="" hiredate="" ";="">cout < "="">p.print();cout <>}private:int ID;Date birthdate;Date hiredate;Parent p;};int main(){int e;cout < "enter="" number="" of="" emplyees:="">cin >> e;Employee e1[10];Parent p;Date bd, hd;for (int i = 0; i < e;="">e1[i].set(bd, hd, p);
for (int i = 0; i < e;="">e1[i].print();return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here