Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CS202 Computer Science II Assignment #4 School Management System Phase 2 1- Problem Description In this assignment, we want to continue working on our school management system to make it more useful....

1 answer below »
CS202 Computer Science II
Assignment #4
School Management System Phase 2
1- Problem Description
In this assignment, we want to continue working on our school management system to make it more
useful. You need to use Object-Oriented Programming concepts including virtual functions and abstract
classes to write your program. There would exist objects of different classes in your system which work
together to make your system productive.
1-1-Classes
In this section, you will see a
ief explanation of the classes in this system
1-1-1- Person
This class is the representative class for all people in the system. The minimum required members for this
class are as follows:
Person
- firstName : string
- familyName : string
- dob : string
+ getName() : string
+ getDOB() : string
+ getID() : int
Members Description and Notes:
- firstName is a string that holds the first name of the person. This variable gets initialized using the
input argument of the class constructor.
- lastName is a string that holds the last name of the person. This variable gets initialized using the
input argument of the class constructor.
- dob is a string that holds the date of birth of the person. dob follows the specific format of the
month/day/year. An example would be “06/14/2020”. This variable gets initialized using the input
argument of the class constructor.
- getName() is a member function that returns the person’s firtsName concatenated to their
familyName. An example of returned value would be “Sina Saravani”.
- getDOB() is a member function that returns the dob.
- getID() is a pure virtual function, to return the ID of a person in the school system. So, each derived
class returns the appropriate id. TeacherAssistant objects return their student id (not faculty id).
1-1-2- Student
This class represents a student in the school system. The student class inherits the properties of the person
class. The minimum extra required members for this class are as follows:
Student
# sid : int
# totalCourses : int
# gpa : double
# registeredCourses : Course*[]
# status : string
+ getCourses() : int *
+ registerStudent(cid : int) : boolean
+ drop(cid : int) : boolean
+ changeStatus(s : string) : void
+ getStatus() : string
Members Description and Notes:
- sid is the student id. This variable gets initialized using the input argument of the class constructor.
- totalCourses is an integer value specifying how many courses this student can register for. This
value is initialized to 6 in the class constructor.
- gpa is the student’s grade point average. This variable initializes to zero in the class constructor.
- registeredCourses is an a
ay that keeps pointers to the courses that the student has registered
for. This a
ay must be managed dynamically. So, in the beginning, it has zero elements. The
elements of this a
ay are pointers to actual objects of the Course class. You may use the
std::vector to implement this a
ay.
- status is a string to shoe the status of the student. It will be one of the values in the set {“active”,
“graduated”, “suspended”}.
- getCourses() returns a poiner to the student’s courses a
ay.
- registerStudent(cid) appends the pointer to the course with provided cid to the student’s
egisteredCourses a
ay. This function also returns a boolean value to indicate if registering has
een successful (return true), or not (return false). There is a limit, indicated by the totalCourses
variable, for the number of courses each student can register for. So, if somebody tries to register
for a course while they have already met their limit, it would not be possible and this function
eturns false.
- drop(cid) finds the a
ay element containing the pointer to the course object with id determined
y cid in the registeredCourses a
ay and removes it from the a
ay. This function also returns a
oolean value to indicate if the drop has been successful (return true), or not (return false). If the
student is not registered for the indicated course, they cannot drop it obviously.
- changeStatus(s) changes the status of the student to value provided in s. You should check if the
provided value is valid (in the set {“active”, “graduated”, “suspended”}).
- getStatus() returns the student’s status.
- Remember the child class constructor must call the base class constructor and pass the
appropriate input arguments to them.
- This class must also implement the getID() function of the Person class to return sid.
1-1-3- GradStudent
This class represents a graduate student in the school system. The graduate student class inherits the
properties of the student class. The minimum extra required members for this class are as follows:
GradStudent
- thesisTitle : string
- adviser : int
+ setThesis(ttitle : string) : void
+ setAdviser(fid : int) : void
Members Description and Notes:
- The totalCourses for grad students must be initialized to 3 instead of 6.
- thesisTitle is the title of the student’s thesis. This variable gets initialized using the class
constructor to “UNKOWN”.
- adviser is the id of the student’s adviser. This variabe gets initialized to -1 using the class
constructor.
- setThesis(ttitle) sets the value of ttitle to the thesisTitle variable.
- setAdviser(fid) sets the value of fid to the adviser variable.
- This class does not need to ove
ide the registerStudent(cid) function of the Student class
anymore.
- Remember the child class constructor must call the base class constructor and pass the
appropriate input arguments to them.
1-1-4- Faculty
This class represents the faculty members in the school system. The faculty class inherits the properties
of the person class. The minimum extra required members for this class are as follows:
Faculty
- fid : int
- courses : Courses*[]
+ getCourses() : int*
+ assignCourse(cid : int) : boolean
+ removeCourse(cid : int) : Boolean
Members Description and Notes:
- fid is the faculty id. This variable gets initialized using the input argument of the class constructor.
- courses is an a
ay that keeps pointers to the courses that the faculty is teaching. This a
ay must
e managed dynamically. So, in the beginning, it has zero elements. The elements of this a
ay
are pointers to actual objects of the Course class. You may use the std::vector to implement this
a
ay.
- getCourses() returns a pointer to the faculty’s courses a
ay.
- assignCourse(cid) appends a pointer to the course with id determined by cid to the courses a
ay.
This function also returns a boolean value to indicate if assigning has been successful (return true),
or not (return false).
- removeCourse(cid) finds the a
ay element containing the pointer to the course with id
determined by cid in the courses a
ay and removes it. This function also returns a boolean value
to indicate if course removal has been successful (return true), or not (return false).
- Remember the child class constructor must call the base class constructor and pass the
appropriate input arguments to them.
- This class must also implement the getID() function of the Person class to return fid.
1-1-5- TeacherAssistant
This class represents teacher assistants in the school system. The TeacherAssistant class inherits from both
the student and the faculty classes. The minimum required members for this class are as follows:
TeacherAssistant
- semester : string
+ getSemester() : string
Members Description and Notes:
- Make sure you handle the diamond problem for this class.
- semester is a string value in set {“Fall”, “Spring”, “Summer”} that shows in which semester the TA
is working. This member must be initialized in the parameterized constructor of the class.
- The registeredCourses a
ay, which is inherited from the Student class, keeps track of the courses
that this TA student has registered for themselves.
- The courses a
ay, which is inherited from the Faculty class, keeps track of the courses that this
student is the teaching assistant for.
- A TA has all the features of a student.
- Using the same assignCourse(cid) and removeCourse(cid) functions of the Faculty class, the
courses that this student is a teaching assistant for are managed.
- getSemester() returns the semester variable.
1-1-6- Course
This class represents a course in the school system. The minimum required members for this class are as
follows:
Course
- cid : int
- cname: string
- courseCapacity: int
- registeredStudents : Student*[]
- teacher: Faculty*
+ getCourseName() : string
+ addStudent(sid : int) : boolean
+ removeStudent(sid : int) : boolean
+ assignTeacher(fid : int) : boolean
+ removeTeacher() : boolean
Members Description and Notes:
- cid is the course id. This variable gets initialized using the input argument of the class constructor.
- cname is the string name of the course. This variable gets initialized using the input argument of
the class constructor.
- courseCapacity is a integer value to show how many students can register for the course.
- registeredStudents is an a
ay that holds pointers to the Student objects that are registered for
the course. This a
ay must be managed dynamically and has no elements by default. You can use
std::vector for it.
- teacher is a pointer to a Faculty object who is teaching this course.
- getCourseName() returns the value of cname variable.
- addStudent(sid) appends the pointer to the student with id determined by sid to the
egisteredStudents a
ay. If the maximum capacity of the course has reached, this function must
eturn false. Otherwise, it returns true to show the success of adding the student to the course.
- removeStudent(sid) removes the element related to the student with id determined by sid from
the registeredStudents a
ay. This function also returns a boolean value to indicate if student
emoval has been successful (return true), or not (return false).
- assignTeacher(fid) puts a pointer to the Faculty object who is teaching this course into the teacher
variable. This function also returns a boolean value to indicate if teacher assignment has been
successful (return true), or not (return false).
- removeTeacher() sets the teacher pointer to point to nothing.
1-2- Notes
• All child classes must call the parent’s constructor.
• You must also implement appropriate constructors for all these classes (they are not provided in
the UML).
Answered Same Day Jun 26, 2021

Solution

Ria answered on Jun 29 2021
133 Votes
#include #include #include using namespace std;
declaring constants
const int MAX_REGISTER = 6;
const int MAX_COURSES = 3;
const int COURSE_CAPACITY = 25;
class Person {
public:
Person(string firstName, string familyName, string dob);
string getName();
string getDOB();
protected:
string firstName;
string familyName;
string dob;
};
Person::Person(string firstName, string familyName, string dob) {
this->firstName = firstName;
this->familyName = familyName;
this->dob = dob;
}
string Person::getName() {
return firstName + " " + familyName;
}
string Person::getDOB() {
return dob;
}
class Student : public Person {
public:
Student(int sid, string firstName, string familyName, string dob);
int getCourseID(int num);
bool registers(int cid);
bool drop(int cid);
protected:
int registeredCourses[MAX_REGISTER] = { -1 };
int sid;
double gpa;
};
Student::Student(int sid, string firstName, string familyName, string dob)
: Person(firstName, familyName, dob)
{
this->sid = sid;
}
int Student::getCourseID(int num)
{
return registeredCourses[num];
}
int -> bool
Produces true if cid was added to registeredCourses a
ay, false if full
ool Student::registers(int cid)
{
for (int i = 0; i < MAX_REGISTER; ++i) {
if (registeredCourses[i] == -1) {
registeredCourses[i] = cid;
return true;
}
}
return false;
}
int -> bool
Return true if given cid was in students registeredCourses and was dropped
false if student wasn't taking course
ool Student::drop(int cid)
{
for (int i = 0; i < MAX_REGISTER; ++i) {
if (registeredCourses[i] == cid) {
registeredCourses[i] = -1;
return true;
}
}
return false;
}
class GradStudent : protected Student
{
public:
GradStudent(int sid, string firstName, string familyName, string dob);
void setThesis(string title);
void setAdvise(int fid);
private:
string thesisTitle;
int adviser;
};
GradStudent::GradStudent(int sid, string firstName, string familyName, string dob)
: Student(sid, firstName, familyName, dob)
{
thesisTitle = "UNKOWN";
adviser = -1;
};
void GradStudent::setThesis(string title) {
thesisTitle = title;
}
void GradStudent::setAdvise(int fid) {
adviser = fid;
}
class Faculty...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here