#include "Student.h" /**************************************************************** FUNCTION: Student() ARGUMENTS: none RETURNS: none NOTES: this is the Student class constructor ****************************************************************/ Student::Student() { count = 0; } /**************************************************************** FUNCTION: ~Student() ARGUMENTS: none RETURNS: none NOTES: this is the destructor for the Student class ****************************************************************/ Student::~Student() { } /**************************************************************** FUNCTION: incrementCount() ARGUMENTS: none RETURNS: none NOTES: This function increments count so that the number of classes added are counted on entry ****************************************************************/ void Student::incrementCount() { count = count + 1; } /**************************************************************** FUNCTION: getZID() ARGUMENTS: none RETURNS: ZID - returns the students ZID number NOTES: This function simply returns the students ZID# ****************************************************************/ string Student::getZID() const { return ZID; } /**************************************************************** FUNCTION: setZID(const string &x) ARGUMENTS: string x RETURNS: none NOTES: this function sets the students ZID with the value passed to it. ****************************************************************/ void Student::setZID(string &x) { ZID = x; } /**************************************************************** FUNCTION: getCount() const ARGUMENTS: none RETURNS: int count NOTES: this function returns the count of the number of classes added to the students registration etc ****************************************************************/ int Student::getCount() const { return count; } /**************************************************************** FUNCTION: infoPrint() ARGUMENTS: none RETURNS: none NOTES: this prints the students information, including the basic information, aswell as class information ****************************************************************/ void Student::infoPrint() { cout << getFirstName() << " " << getLastName() << " " << getSSN() << " " << getDOB() << " " << getGender() << " " << getZID() << endl; nodeSLL * next = courseList.getHead(); while (next != NULL) { cout << next->info.getCourseID() << " " << next->info.getYearTaken() << " " << next->info.getSemesterTaken() << " " << next->info.getGrade() << endl; next = next->next; } } void Student::loadInfoFromFile(fstream& inFile) { string firstName, lastName, SSN, DOB, gender, ZID, courseID, year, semester, grade; inFile >> firstName; setFirstName(firstName); inFile >> lastName; setLastName(lastName); inFile >> SSN; setSSN(SSN); inFile >> DOB; setDOB(DOB); inFile >> gender; setGender(gender); inFile >> ZID; setZID(ZID); //start class read inFile >> courseID; while (inFile) { inFile >> year; inFile >> semester; inFile >> grade; CourseInfo courses; courses.setCourseID(courseID); courses.setYearTaken(year); courses.setSemesterTaken(semester); courses.setGrade(grade); addCourse(getZID(), courses); inFile >> courseID; } } /**************************************************************** FUNCTION: addCourse() ARGUMENTS: none RETURNS: none NOTES: this adds a course to the front of the list ****************************************************************/ void Student::addCourse(string ZID, const CourseInfo& c1) { courseList.addToHead(c1); } /**************************************************************** FUNCTION: deleteCourse() ARGUMENTS: const CourseInfo& delCourse RETURNS: none NOTES: this functions deletes a course from the list ****************************************************************/ void Student::deleteCourse(const CourseInfo& delCourse) { // Call the deleteNode() method for the linked list of courses courseList.deleteNode(delCourse); } /**************************************************************** FUNCTION: checkCourseTaken() ARGUMENTS: string zid, CourseInfo c1 RETURNS: CourseInfo NOTES: this function checks if a course was taken ****************************************************************/ CourseInfo Student::checkCourseTaken(string ZID, CourseInfo c1) { courseList.checkCourseTaken(c1); return c1; } /**************************************************************** FUNCTION: checkCourseTaken() ARGUMENTS: string courseId, string year, string semester RETURNS: string grade NOTES: this function checks if a course was taken ****************************************************************/ string Student::checkCourseTaken(string courseID, string year, string semester) { CourseInfo temp; temp.setCourseID(courseID); temp.setYearTaken(year); temp.setSemesterTaken(semester); nodeSLL * next = courseList.getHead(); while (next != NULL) { if (next->info == temp) return next->info.getGrade(); next = next->next; } return "failed"; } void Student::clearCourseList() { courseList.clear(); }