Advertisement
jeff69

Untitled

Oct 5th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. class Year{
  7.     private:
  8.         string year;
  9.     public:
  10.         Year(){}
  11.         void setYear(string y){
  12.             year = y;
  13.         }
  14.         void printYear(){
  15.             cout << "Year " << year << endl;
  16.         }
  17. };
  18.  
  19. class Name{
  20.     private:
  21.         string givenName;
  22.         string familyName;
  23.     public:
  24.         Name(){}
  25.  
  26.         void setName(string n1, string n2){
  27.             givenName = n1;
  28.             familyName = n2;
  29.         }
  30.  
  31.         void printName(){
  32.             cout << "Given Name " << givenName << endl;
  33.             cout << "Family Name " << familyName << endl;
  34.         }
  35. };
  36.  
  37. class LectureCourse; // declaring it for use in classes Student, Instructor, Assistant
  38. class Instructor;
  39. class Student;
  40. class Assistant;
  41.  
  42. class LectureCourse{
  43.     private:
  44.         string title;
  45.         Year year;
  46.         Instructor * instructor;
  47.         Assistant ** assistants;
  48.         bool core;
  49.         bool elective;
  50.         int size;
  51.     public:
  52.         LectureCourse(string s, Instructor * i, Assistant *a[], int n, bool c){
  53.             title = s;
  54.             instructor = i;
  55.             assistants = new Assistant*[n];
  56.             for(int i = 0; i<n; i++){
  57.                 assistants[i] = a[i];
  58.             }
  59.             core = c;
  60.             elective = !c;
  61.             size = n;
  62.         }
  63.  
  64.         void printLectureCourse(){
  65.             cout << "Title " << title << endl;
  66.             year.printYear();
  67.             instructor->printInstructorName();
  68.             for(int i = 0; i<size; i++){
  69.                 assistants[i]->printAssistantName();
  70.             }
  71.             cout << "Core " << core << endl;
  72.             cout << "Elective " << elective << endl;
  73.         }
  74. };
  75. class Student
  76. {
  77.     private:
  78.         Name name;
  79.         Year year;
  80.         LectureCourse ** lectures;
  81.         int size;
  82.     public:
  83.         Student(){}
  84.         Student(string n1, string n2, string y, LectureCourse *a[], int n){
  85.             name.setName(n1, n2);
  86.             year.setYear(y);
  87.             lectures = new LectureCourse*[n];
  88.             for(int i = 0; i<n; i++){
  89.                 lectures[i] = a[i];
  90.             }
  91.             size = n;
  92.         }
  93.         void printStudent(){
  94.             LectureCourse * f;
  95.             f->LectureCourse();
  96.             name.printName();
  97.             for(int i = 0; i<size; i++){
  98.                 lectures[i]->printLectureCourse();
  99.             }
  100.         }
  101.         void printStudentName(){
  102.             name.printName();
  103.         }
  104. };
  105.  
  106. class Instructor{
  107.     private:
  108.         Name name;
  109.         LectureCourse ** lectures;
  110.         int size;
  111.     public:
  112.         Instructor(string n1, string n2){
  113.             name.setName(n1, n2);
  114.         }
  115.         void assignLectureCourse(LectureCourse *a[], int n){
  116.             lectures = new LectureCourse*[n];
  117.             for(int i = 0; i<n; i++){
  118.                 lectures[i] = a[i];
  119.             }
  120.             size = n;
  121.         }
  122.  
  123.         void printInstructor(){
  124.             name.printName();
  125.             for(int i = 0; i<size; i++){
  126.                 //lectures[i]->printLectureCourse();
  127.             }
  128.         }
  129.         void printInstructorName(){
  130.             name.printName();
  131.         }
  132.  
  133. };
  134.  
  135. class Assistant{
  136.     private:
  137.         Name name;
  138.         LectureCourse ** lectures;
  139.         int size;
  140.     public:
  141.         Assistant(string n1, string n2){
  142.             name.setName(n1, n2);
  143.         }
  144.         void assignLectureCourse(LectureCourse *a[], int n){
  145.             lectures = new LectureCourse*[n];
  146.             for(int i = 0; i<n; i++){
  147.                 lectures[i] = a[i];
  148.             }
  149.             size = n;
  150.         }
  151.         void printAssistant(){
  152.             name.printName();
  153.             for(int i = 0; i<size; i++){
  154.                 lectures[i];//->printLectureCourse();
  155.             }
  156.         }
  157.         void printAssistantName(){
  158.             name.printName();
  159.         }
  160. };
  161.  
  162.  
  163. class Auditorium{
  164.     private:
  165.         string day;
  166.         string time;
  167.         int roomNo;
  168.     public:
  169.         Auditorium(string d, string t, int i){
  170.             day = d;
  171.             time = t;
  172.             roomNo = i;
  173.         }
  174.  
  175.         void changeAuditorium(string d, string t, int i){
  176.             day = d;
  177.             time = t;
  178.             roomNo = i;
  179.         }
  180.  
  181.         void printAuditorium(){
  182.             cout << "Day " << day << endl;
  183.             cout << "Time " << time << endl;
  184.             cout << "room number " << roomNo << endl;
  185.         }
  186. };
  187.  
  188. class Lecture{
  189.     private:
  190.         LectureCourse * lecture;
  191.         Auditorium * room;
  192.     public:
  193.         Lecture(Auditorium *a, LectureCourse *lc){
  194.             room = a;
  195.             lecture = lc;
  196.         }
  197.         void printLecture(){
  198.             lecture->printLectureCourse();
  199.             room->printAuditorium();
  200.         }
  201. };
  202.  
  203. class TeachingDay{
  204.     private:
  205.         int size;
  206.         Lecture ** lectures;
  207.     public:
  208.         TeachingDay(){}
  209.         TeachingDay(Lecture *a[], int n){
  210.             lectures = new Lecture*[n];
  211.             for(int i = 0; i<n; i++){
  212.                 lectures[i] = a[i];
  213.             }
  214.             size = n;
  215.         }
  216.  
  217.         void printTeachingDay(){
  218.             for(int i = 0; i<size; i++){
  219.                 lectures[i]->printLecture();
  220.             }
  221.         }
  222. };
  223.  
  224. class TeachingWeek{
  225.     private:
  226.         const int size = 7;
  227.         TeachingDay ** week;
  228.     public:
  229.         TeachingWeek(TeachingDay *w[]){
  230.             week = new TeachingDay*[size];
  231.             for(int i = 0; i<size; i++){
  232.                 week[i] = w[i];
  233.             }
  234.         }
  235.         void printTeachingWeek(){
  236.             for(int i = 0; i<size; i++){
  237.                 week[i]->printTeachingDay();
  238.             }
  239.         }
  240. };
  241.  
  242. int main(){
  243.     return 0;
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement