#include"iostream" #include"cstring" using namespace std; const int size = 100; int studentSize, facultySize, adminSize, normalSize; class aiub { char *name; char *id; public: aiub(){} aiub(char *,char *); aiub(const aiub &); void setName(char *); void setId(char *); char *getName()const { return name; } char *getId()const { return id; } char *createId(char ,char *); }; class student:public aiub { char *semester; char *department; char *admissionDate; float cgpa; int creditCompleted; int creditTaken; public: student(){} student(char *, char *, char *, char *,char *, float, int, int); student(const student &); void setSemester(char *); void setDepartment(char *); void setAdmissionDate(char *); void setCgpa(float); void setCreditComplete(int); void setCreditTaken(int ); char *getSemester()const { return semester; } char *getDepartment()const { return department; } float getCgpa()const { return cgpa; } int getCreditComplete()const { return creditCompleted; } int getCreditTaken()const { return creditTaken; } char *getAdmissionDate()const { return admissionDate; } void showAllStudent()const; }; class staff:public aiub { long salary; char *joinDate; public: staff(){} staff(long, char *, char *, char *); staff(const staff &); void setSalary(long); void setJoinDate(char *); long getSalary()const { return salary; } char *getJoinDate()const { return joinDate; } }; class admin:public staff { char *section; public: admin(){} admin(char *, char *,char *,char *, long); admin(const admin &); void setSection(char *); char *getSection()const { return section; } void showAllAdmin()const; }; class faculty:public staff { char *department; char *education; public: faculty(){} faculty(char *,char *, char *, char *, char *, long); faculty(const faculty &); void setDepartment(char *); void setEducation(char *); char *getDepartment()const { return department; } char *getEducation()const { return education; } void showAllFaculty()const; }; class normal:public staff { char *jobType; public: normal(){} normal(char *,char *, char *, char *, long); normal(const normal &); void setJobType(char *); char *getJobType()const { return jobType; } void showAllNormalStaff()const; }; int menu(char c) { int choice; if( c == 'L') { while(1){ cout <<"\n\n"; cout <<"\n 1)Student Admission"; cout <<"\n 2)Staff joining"; cout <<"\n 3)Change Student Info"; cout <<"\n 4)Show All Student"; cout <<"\n 5)Show All Administrator"; cout <<"\n 6)Show All Faculty"; cout <<"\n 7)Show All Mama..."; cout <<"\n 8)Show All Information"; cout <<"\n 9)Clear Screen....."; cout <<"\n 0)Exit from Program"; cout <<"\n Enter u'r choice: "; cin >> choice; if(choice < 0 || choice > 9) cout<<"\nPlease Enter the Correct Number."; else break; } } else if( c == 'S') { while(1){ cout <<"\n\n"; cout <<"\n\t 1)Admin Joining"; cout <<"\n\t 2)Faculty Joining"; cout <<"\n\t 3)Normal Staff Joining"; cout <<"\n\t 4)Go back."; cout <<"\n\t 5)Exit"; cout <<"\n\t Enter u'r choice: "; cin >> choice; if(choice < 1 || choice > 5) cout<<"\nPlease Enter the Correct Number.\n"; else break; } } else { while(1){ cout <<"\n\n"; cout <<"\n\t 1)Change Grade"; cout <<"\n\t 2)Change Credit Which Completed"; cout <<"\n\t 2)Change Credit Which Taken"; cout <<"\n\t 4)Go back"; cout <<"\n\t 5)Exit"; cout <<"\n\t Enter u'r choice: "; cin >> choice; if(choice < 1 || choice > 5) cout<<"\nPlease Enter the Correct Number.\n"; else break; } } return choice; } aiub::aiub(char *nm,char *id) { name = new char[strlen(nm)+1]; strcpy(name, nm); this->id = new char[strlen(id)+1]; strcpy(this->id, id); } aiub::aiub(const aiub &a) { name = new char[strlen(a.name)+1]; strcpy(name, a.name); id = new char[strlen(a.id)+1]; strcpy(id, a.id); } void aiub::setName(char *nm) { name = new char[strlen(nm)+1]; strcpy(name, nm); } void aiub::setId(char *id) { this->id = new char[strlen(id)+1]; strcpy(this->id, id); } char *aiub::createId(char c,char *day) { char *y, *id; int len, ii; long i = 0; id = new char[50]; y = new char[10]; cout<<"\nEnter Semester(1 for Spring, 2 for summer, 3 for Fall): "; cin>>ii; switch(c) { case 's': while(i<100) i = rand()%999; break; case 'a': while(i<10000) i = rand()%99999; break; case 'f': while(i<1000) i = rand()%9999; break; case 'n': while(i<100) i = rand()%999; break; } len = strlen(day); len -= 2; y[0] = day[len]; y[1] = day[len+1]; y[2] = '\0'; strcpy(id,y); if(c == 's') strcat(id,"-03"); else strcat(id,"-"); strcat(id,itoa(i,y,20)); strcat(id,"-"); strcat(id,itoa(ii, y,20)); cout<<"\nYour ID is "<cgpa = cgpa; creditCompleted = cc; creditTaken = ct; } student::student(const student &s):aiub(s) { semester = new char[strlen(s.semester)+1]; strcpy(semester, s.semester); department = new char[strlen(s.department)+1]; strcpy(department, s.department); admissionDate = new char[strlen(s.admissionDate)+1]; strcpy(admissionDate, s.admissionDate); cgpa = s.cgpa; creditCompleted = s.creditCompleted; creditTaken = s.creditTaken; } void student::setSemester(char *sems) { semester = new char[strlen(sems)+1]; strcpy(semester, sems); } void student::setDepartment(char *dept) { department = new char[strlen(dept)+1]; strcpy(department, dept); } void student::setAdmissionDate(char *ad) { admissionDate = new char[strlen(ad)+1]; strcpy(admissionDate, ad); } void student::setCgpa(float cgpa) { this->cgpa = cgpa; } void student::setCreditComplete(int cc) { creditCompleted = cc; } void student::setCreditTaken(int ct) { creditTaken = ct; } void student::showAllStudent()const { cout<<"\n"; cout<<"\n Student Name : "<>nm; cout<<"\nEnter Admission Date(Jan,1,2004)NO SPACE: "; cin>>jd; cout<<"\nWhich Department do you want to choose to get admission: "; cin>>dept; id = st[studentSize].createId('s',jd); st[studentSize].setName(nm); st[studentSize].setId(id); st[studentSize].setSemester("First"); st[studentSize].setAdmissionDate(jd); st[studentSize].setDepartment(dept); st[studentSize].setCgpa(0.0); st[studentSize].setCreditComplete(0); st[studentSize].setCreditTaken(12); studentSize++; break; case 2: choice = menu('S'); switch(choice) { case 1:// admin joining cout<<"Enter your name: "; cin>>nm; cout<<"\nEnter Joining Date(Jan,1,2004)NO SPACE: "; cin>>jd; cout<<"\nWhich Section do you want to work: "; cin>>dept; id = ad[adminSize].createId('a',jd); ad[adminSize].setName(nm); ad[adminSize].setId(id); ad[adminSize].setJoinDate(jd); ad[adminSize].setSection(dept); do{ sal = rand()%200; }while(sal<40); sal*=1000; ad[adminSize].setSalary(sal); adminSize++; break; case 2:// faculty joining cout<<"Enter your name: "; cin>>nm; cout<<"\nEnter Joining Date(Jan,1,2004)NO SPACE: "; cin>>jd; cout<<"\nWhich Department do you want to teach: "; cin>>dept; cout<<"\nEnter Your Education Type(Graduate/Post Graduate/ Ph.D): "; cin>>edu; id = fact[facultySize].createId('f',jd); fact[facultySize].setName(nm); fact[facultySize].setId(id); fact[facultySize].setJoinDate(jd); do{ sal = rand()%100; }while(sal<20); sal*=1000; fact[facultySize].setSalary(sal); fact[facultySize].setEducation(edu); fact[facultySize].setDepartment(dept); facultySize++; break; case 3: // normal staff joining cout<<"Enter your name: "; cin>>nm; cout<<"\nEnter Joining Date(Jan,1,2004)NO SPACE: "; cin>>jd; cout<<"\nEnter your Type of Job: "; cin>>dept; id = n[normalSize].createId('n',jd); n[normalSize].setName(nm); n[normalSize].setId(id); n[normalSize].setJoinDate(jd); do{ sal = rand()%12; }while(sal<4); sal*=1000; n[normalSize].setSalary(sal); n[normalSize].setJobType(dept); normalSize++; break; case 4: // Go to Main menu break; case 5: exit(1); } break; case 3: if(!login) { cout<<"\nLogin Name: "; cin>>nm; cout<<"\nPASSWORD: "; cin>>id; } if((!strcmp(nm,"admin") && !strcmp(id,"dulon")) || login) { login = 1; choice = menu('N'); } else choice = -1; switch(choice) { case 0: cout<<"\nYour Id is not found."; break; case 1: cout<<"\nEnter Student ID: "; cin>>id; for(i=0; i>gr; st[i].setCgpa(gr); cout<<"\nDo you want to logOUT? if then enter '0'(zero) else '1'(one): "; cin>>login; break; } if(i==studentSize)//has been changed cout<<"\nId was not found"; break;//break for switch case 2: cout<<"\nEnter Student ID: "; cin>>id; for(i=0; i>cr; st[i].setCreditComplete(cr); cout<<"\nDo you want to logOUT? if then enter '0'(zero) else '1'(one): "; cin>>login; break; } if(i==studentSize)//has been changed cout<<"\nId was not found"; break; case 3: cout<<"\nEnter Student ID: "; cin>>id; for(i=0; i>cr; st[i].setCreditTaken(cr); cout<<"\nDo you want to logOUT? if then enter '0'(zero) else '1'(one): "; cin>>login; break; } if(i==studentSize)//has been changed cout<<"\nId was not found"; break; case 4: // Go to Main menu cout<<"\nDo you want to logOUT? if then enter '0'(zero) else '1'(one): "; cin>>login; break; case 5: exit(1); default: cout<<"\nWrong user name or password"; } break; case 4: //show student cout<<"***********************\n"; cout<<"* STUDENT INFORMATION *\n"; cout<<"***********************"; for(i = 0; i