Design via Association (class details on following pages)

The Instructor, Student and Course classes interact with each other to form a simple object-oriented via association. This means that each class will store objects of the other two via pointers so that all objects have independent lifetimes. Thus, a Student will continue to exist whether they add or drop a Course, and a Course would continue to exist whether or not the Student takes it or drops it.

For example, a Course will have a pointer to an Instructor object and a MyArray object of pointers to Student objects. A Student will have a MyArray object of pointers to Course objects. Finally, an Instructor will have a MyArray object of pointers to Course objects.

Each class will have the ability to add or remove a relationship with other classes. For example, a Student can drop a Course before the drop date, or a Course can drop a Student (automated process due to lack of attendance). In practice it may not make sense for a Course to add a Student. However, a Course must provide an add Student function so that a Student object can use this function to add itself to the Course object, and so on.

Forward Declarations

Due to the circular OOP design of this (Students must be aware of Courses at the same time that Courses must be aware of Students etc.) you must forward declare your Instructor, Student and Course classes.

For example, if the definition of class A includes references to B objects and/or B functions, and the definition of class B includes references to A objects and/or A functions we must do the following in their respective .h files:

// A.h file #include B.h // include the B.h file class B; // forward declaration of B class A {

};

// B.h file #include A.h // include the A.h file class A; // forward declaration of A class B {

};

Class Specifics

MyArray Template Class

This is a safe, partially filled dynamic array template class that must be declared and defined in a single MyArray.h file (no MyArray.cpp file).

All functions of this class should handle any possible errors that may occur when interacting with an array. For example, a constructor should not attempt to create an array of a negative size.

  1. data members:

a) data – dynamic array of type T

  1. constructors:

a) default – create an empty array of capacity 10 b) single parameter – create an array of a specified capacity

  1. functions:

a) getSize – return the number of elements in the array b) grow – private grow function (capacity*2)+ c) getIndex – given a value, return the position or -1 if not found. d) push_back – add element to the end of the array e) erase – remove the element at the specified index f) [] – overloaded [] operator: accept an index as input, return the element if it exists

  1. the big three

(^)

Instructor Class

  1. data members: a) name – full name of the Instructor (with title) b) department – name of the Instructors department b) courses – MyArray object which stores course object pointers
  2. constructors: a) default – create an anonymous Instructor (set name to Staff) b) single parameter – create an Instructor with name c) dual parameter – create an Instructor with name and department
  3. functions: a) getName – accessor for name b) setName – mutator for name c) getDepartment – accessor for department d) setDepartment – mutator for department d) addCourse – add a specified Course (if not already added), update the Course object to reflect the change e) dropCourse – remove a specified Course (if teaching course) update the Course object to reflect the change f) display – displays the Instructor name, department and list of Courses

Student Class

  1. data members: a) name – full name of the Student b) courses – MyArray object which stores Course object pointers
  2. constructors: a) default – create an anonymous Student b) single parameter – create a Student with a specified name
  3. functions: a) getName – accessor for name b) setName – mutator for name d) addCourse – add a specified Course (if not already added), update the Course object to reflect the change e) dropCourse – remove a specified Course (if enrolled in course) update the Course object to reflect the change f) display – display the Student name and a list of courses, use the overloaded [] operator from MyArray g) << – overloaded << operator displays the Student name

Course Class

  1. data members: a) name – Course number/section b) instructor – Instructor object pointer b) students – MyArray object which stores Student object pointers
  2. constructors: a) default – create an anonymous Instructor b) dual parameter – create a course with a name and Instructor
  3. functions: a) getName – accessor for name b) setName – mutator for name c) getInstructor – accessor for Instructor, return Instructor object d) setInstructor – setter for Instructor, accept Instructor object e) addStudent – add a specified Student (if not already enrolled) update the Student object to reflect the change f) dropStudent – remove a specified Student (if enrolled) update the Student object to reflect the change g) dropInstructor – replace current Instructor with Staff, use the default Instructor constructor update the Instructor object to reflect the change g) display – display the Instructor name, display a list of Students, use the overloaded << operator from Student

在線提交訂單



在線客服

售前咨詢
售后咨詢
微信號
Essay_Cheery
微信
加拿大澳洲英国代写,网课代上,网课代考,论文代写-assignment due® essay代写,留学生代写,英国硕士论文代,经济代写,数学,CS代写 essay代写,网课代考,统计代写,金融代写,代做功課服務-靠谱代写 一站式論文代寫,硕士论文代写,essay代写,统计代写 新西兰代写assignment,CS代写,数学代写,essay代写,统计代写-Excellent due 美国代写,北美专业代写留学生论文,CS作业代写-EasyDue™ Assignment代写,美国代写网课代做,商科assignment代写网课 作业代写,論文代寫代写assignment-北美最好的一站式学术代写服务机构 代写essay,论文加急,论文代写,北美顶级代写-EssayV美国论文代写 加拿大代写assignment,英国、美国、澳洲留学生论文代写,论文代写