Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Year{
- private:
- string year;
- public:
- Year(){}
- void setYear(string y){
- year = y;
- }
- void printYear(){
- cout << "Year " << year << endl;
- }
- };
- class Name{
- private:
- string givenName;
- string familyName;
- public:
- Name(){}
- void setName(string n1, string n2){
- givenName = n1;
- familyName = n2;
- }
- void printName(){
- cout << "Given Name " << givenName << endl;
- cout << "Family Name " << familyName << endl;
- }
- };
- class LectureCourse; // declaring it for use in classes Student, Instructor, Assistant
- class Instructor;
- class Student;
- class Assistant;
- class LectureCourse{
- private:
- string title;
- Year year;
- Instructor * instructor;
- Assistant ** assistants;
- bool core;
- bool elective;
- int size;
- public:
- LectureCourse(string s, Instructor * i, Assistant *a[], int n, bool c){
- title = s;
- instructor = i;
- assistants = new Assistant*[n];
- for(int i = 0; i<n; i++){
- assistants[i] = a[i];
- }
- core = c;
- elective = !c;
- size = n;
- }
- void printLectureCourse(){
- cout << "Title " << title << endl;
- year.printYear();
- instructor->printInstructorName();
- for(int i = 0; i<size; i++){
- assistants[i]->printAssistantName();
- }
- cout << "Core " << core << endl;
- cout << "Elective " << elective << endl;
- }
- };
- class Student
- {
- private:
- Name name;
- Year year;
- LectureCourse ** lectures;
- int size;
- public:
- Student(){}
- Student(string n1, string n2, string y, LectureCourse *a[], int n){
- name.setName(n1, n2);
- year.setYear(y);
- lectures = new LectureCourse*[n];
- for(int i = 0; i<n; i++){
- lectures[i] = a[i];
- }
- size = n;
- }
- void printStudent(){
- LectureCourse * f;
- f->LectureCourse();
- name.printName();
- for(int i = 0; i<size; i++){
- lectures[i]->printLectureCourse();
- }
- }
- void printStudentName(){
- name.printName();
- }
- };
- class Instructor{
- private:
- Name name;
- LectureCourse ** lectures;
- int size;
- public:
- Instructor(string n1, string n2){
- name.setName(n1, n2);
- }
- void assignLectureCourse(LectureCourse *a[], int n){
- lectures = new LectureCourse*[n];
- for(int i = 0; i<n; i++){
- lectures[i] = a[i];
- }
- size = n;
- }
- void printInstructor(){
- name.printName();
- for(int i = 0; i<size; i++){
- //lectures[i]->printLectureCourse();
- }
- }
- void printInstructorName(){
- name.printName();
- }
- };
- class Assistant{
- private:
- Name name;
- LectureCourse ** lectures;
- int size;
- public:
- Assistant(string n1, string n2){
- name.setName(n1, n2);
- }
- void assignLectureCourse(LectureCourse *a[], int n){
- lectures = new LectureCourse*[n];
- for(int i = 0; i<n; i++){
- lectures[i] = a[i];
- }
- size = n;
- }
- void printAssistant(){
- name.printName();
- for(int i = 0; i<size; i++){
- lectures[i];//->printLectureCourse();
- }
- }
- void printAssistantName(){
- name.printName();
- }
- };
- class Auditorium{
- private:
- string day;
- string time;
- int roomNo;
- public:
- Auditorium(string d, string t, int i){
- day = d;
- time = t;
- roomNo = i;
- }
- void changeAuditorium(string d, string t, int i){
- day = d;
- time = t;
- roomNo = i;
- }
- void printAuditorium(){
- cout << "Day " << day << endl;
- cout << "Time " << time << endl;
- cout << "room number " << roomNo << endl;
- }
- };
- class Lecture{
- private:
- LectureCourse * lecture;
- Auditorium * room;
- public:
- Lecture(Auditorium *a, LectureCourse *lc){
- room = a;
- lecture = lc;
- }
- void printLecture(){
- lecture->printLectureCourse();
- room->printAuditorium();
- }
- };
- class TeachingDay{
- private:
- int size;
- Lecture ** lectures;
- public:
- TeachingDay(){}
- TeachingDay(Lecture *a[], int n){
- lectures = new Lecture*[n];
- for(int i = 0; i<n; i++){
- lectures[i] = a[i];
- }
- size = n;
- }
- void printTeachingDay(){
- for(int i = 0; i<size; i++){
- lectures[i]->printLecture();
- }
- }
- };
- class TeachingWeek{
- private:
- const int size = 7;
- TeachingDay ** week;
- public:
- TeachingWeek(TeachingDay *w[]){
- week = new TeachingDay*[size];
- for(int i = 0; i<size; i++){
- week[i] = w[i];
- }
- }
- void printTeachingWeek(){
- for(int i = 0; i<size; i++){
- week[i]->printTeachingDay();
- }
- }
- };
- int main(){
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement