def _get_instructors(self, path):

        try:
            #Instructor file with CWID, name and department.
            for cwid, name, dept in file_read(path, 3, sep='\t', header=False):
                #Warning for cwid duplication if present in self._instructors.
                if cwid in self._instructors:
                    print(f' Warning: cwid {cwid} already read from the file')
                #Print instructors CWID, name and deptartment.
                else:
                    self._instructors[cwid] = Instructor(cwid, name, dept)
        except ValueError as error:
            print(error)
    def _get_majors(self, path):
        try:
            for major, course, flag in file_read(path,
                                                 3,
                                                 sep="\t",
                                                 header=False):
                if major in self._majors:
                    self._majors[major].add_course(flag, course)
                else:
                    self._majors[major] = Major(major)

        except ValueError as err:
            print(err)
Esempio n. 3
0
 def _get_students(self, path):
     
     try:
         #Studen file with CWID, name and major.
         for cwid, name, major in file_read(path, 3, sep = '\t', header = False):
             #Warning for cwid duplication if present in self._students.
             if cwid in self._students:
                 print (f' Warning: cwid {cwid} already read from the file')
             #Print student's CWID, name and major.
             else:
                 self._students[cwid] = Student(cwid, name, major)
     except ValueError as error:
         print(error)
Esempio n. 4
0
 def _get_grades(self, path):
 
     try:
         #Grades file with Student CWID, course and grade and also instructor CWID.
         for student_cwid, course, grade, instructors_cwid in file_read(path, 4, sep = '\t', header = False):
             #Displays students new updated course and grades.
             if student_cwid in self._students:
                 self._students[student_cwid].add_course(course, grade) 
             else:
                 #Invalid CWID, not on file.
                 print (f' Warning: student cwid {student_cwid} is not known in the file') 
         
             #Instructor updates students on their respective course and grades.
             if instructors_cwid in self._instructors:
                 self._instructors[instructors_cwid].add_course(course) 
             else:
                 print (f' Warning: instructor cwid {instructors_cwid} is not known in the file') 
     except ValueError as error:
         print (error)