def displayFilterStudentsInUnit(self, university): print("\n \n \n") code = input("Enter a Unit code: ") if university.unitExists(code): unit = university.units[code] print("Please select your filters: ") print("Select study filter: ") print("[1] - Full-time students \n[2] - Part-time students \n[3] - Either") command = promptCommand(1,3) command = int(command) if command == 1: studType = 'F' elif command == 2: studType = 'P' else: studType = 'either' print("select residency filter: ") print("[1] - Domestic students \n[2] - International students \n[3] - Either") command = promptCommand(1,3) command = int(command) if command == 1: resType = 'D' elif command == 2: resType = 'I' else: resType = 'either' print("select degree type filter: ") print("[1] - Undergraduate students \n[2] - Postgraduate students \n[3] - Either") command = promptCommand(1,3) command = int(command) if command == 1: degType = 'U' elif command == 2: degType = 'P' else: degType = 'either' print("Displaying students in " + unit.getCode() + " with filters: ") print("Study Type = " + str(studType) + " | Residency Type = " + str(resType) + " | Degree Type = " + str(degType)) for studID in unit.students: currentStudent = university.students[studID] if currentStudent.getStudyType() == studType or studType == 'either': if currentStudent.getResidencyType() == resType or resType == 'either': if currentStudent.getDegreeType() == degType or degType == 'either': print(studID + " - Name: " + currentStudent.getName() + " course: " + str(currentStudent.getCourse())) else: print("ERROR: Unit code does not exist")
def unitsMenu(): print("\nUNITS OPTIONS" + "\n" + "\n [1] Create Unit" + "\n [2] Search Unit" + "\n [3] Display All Units" + "\n [4] Display Students in Unit" + "\n [5] Edit Unit Details" + "\n [6] Delete Unit" + "\n [7] Filter Search students in unit" "\n [8] Back to Main Menu") command = promptCommand(1, 8) if int(command) == 1: admin.createUnit(monash) unitsMenu() if int(command) == 2: admin.searchUnit(monash) unitsMenu() if int(command) == 3: admin.displayAllUnits(monash) unitsMenu() if int(command) == 4: admin.displayStudentsInUnit(monash) unitsMenu() if int(command) == 5: admin.editUnitDetails(monash) unitsMenu() if int(command) == 6: admin.deleteUnit(monash) unitsMenu() if int(command) == 7: admin.displayFilterStudentsInUnit(monash) unitsMenu() if int(command) == 8: mainMenu(baseID)
def coursesMenu(): print("\nCOURSES OPTIONS" + "\n" + "\n [1] Create Course" + "\n [2] Search Course" + "\n [3] Display All Courses" + "\n [4] Display Units in Course" + "\n [5] Edit Course Details" + "\n [6] Delete Course" + "\n [7] Display students in course with filter" + "\n [8] Back to Main Menu") command = promptCommand(1, 8) if int(command) == 1: admin.createCourse(monash) coursesMenu() if int(command) == 2: admin.searchCourse(monash) coursesMenu() if int(command) == 3: admin.displayAllCourses(monash) coursesMenu() if int(command) == 4: admin.displayUnitsInCourse(monash) coursesMenu() if int(command) == 5: admin.editCourseDetails(monash) coursesMenu() if int(command) == 6: admin.deleteCourse(monash) coursesMenu() if int(command) == 7: admin.displayFilterStudentsInCourse(monash) coursesMenu() if int(command) == 8: mainMenu(baseID)
def studentsMenu(baseID): print("\nSTUDENTS OPTIONS" + "\n" + "\n [1] Create Student" + "\n [2] Search Student" + "\n [3] Enrol Student" + "\n [4] Display Undergraduate Students" + "\n [5] Display Postgraduate Students" + "\n [6] Display Domestic Students" + "\n [7] Display International Students" + "\n [8] Is Student enrolled in Unit?" + "\n [9] Is Student enrolled in Course?" + "\n [10] Edit Student Details" + "\n [11] Delete Student" + "\n [12] Back to Main Menu" ) command = promptCommand(1,12) if int(command) == 1: nunv = admin.createStudent(baseID,monash) baseID = nunv # input("Hit enter to return to menu") studentsMenu(baseID) if int(command) == 2: admin.searchStudent(monash) studentsMenu(baseID) if int(command) == 3: admin.enrolStudent(monash) studentsMenu(baseID) if int(command) == 4: admin.displayUndergraduateStudents(monash) studentsMenu(baseID) if int(command) == 5: admin.displayPostgraduateStudents(monash) studentsMenu(baseID) if int(command) == 6: admin.displayDomesticStudents(monash) studentsMenu(baseID) if int(command) == 7: admin.displayInternationalStudents(monash) studentsMenu(baseID) if int(command) == 8: admin.checkUnitEnrolment(monash) studentsMenu(baseID) if int(command) == 9: admin.checkCourseEnrolment(monash) studentsMenu(baseID) if int(command) == 10: admin.editStudentDetails(monash) studentsMenu(baseID) if int(command) == 11: admin.deleteStudent(monash) studentsMenu(baseID) if int(command) == 12: mainMenu(baseID)
def studentsMenu(baseID): print("\nSTUDENTS OPTIONS" + "\n" + "\n [1] Create Student" + "\n [2] Search Student" + "\n [3] Enrol Student" + "\n [4] Display Undergraduate Students" + "\n [5] Display Postgraduate Students" + "\n [6] Display Domestic Students" + "\n [7] Display International Students" + "\n [8] Is Student enrolled in Unit?" + "\n [9] Is Student enrolled in Course?" + "\n [10] Edit Student Details" + "\n [11] Delete Student" + "\n [12] Back to Main Menu") command = promptCommand(1, 12) if int(command) == 1: nunv = admin.createStudent(baseID, monash) baseID = nunv # input("Hit enter to return to menu") studentsMenu(baseID) if int(command) == 2: admin.searchStudent(monash) studentsMenu(baseID) if int(command) == 3: admin.enrolStudent(monash) studentsMenu(baseID) if int(command) == 4: admin.displayUndergraduateStudents(monash) studentsMenu(baseID) if int(command) == 5: admin.displayPostgraduateStudents(monash) studentsMenu(baseID) if int(command) == 6: admin.displayDomesticStudents(monash) studentsMenu(baseID) if int(command) == 7: admin.displayInternationalStudents(monash) studentsMenu(baseID) if int(command) == 8: admin.checkUnitEnrolment(monash) studentsMenu(baseID) if int(command) == 9: admin.checkCourseEnrolment(monash) studentsMenu(baseID) if int(command) == 10: admin.editStudentDetails(monash) studentsMenu(baseID) if int(command) == 11: admin.deleteStudent(monash) studentsMenu(baseID) if int(command) == 12: mainMenu(baseID)
def mainMenu(baseID): print( "---------------------------------------------------------------------" ) print("\nWELCOME, COURSE ADMIN!" + "\n" + "\n [1] Courses Menu" + "\n [2] Units Menu" + "\n [3] Students Menu" + "\n [4] Quit") command = promptCommand(1, 4) if int(command) == 1: coursesMenu() if int(command) == 2: unitsMenu() if int(command) == 3: studentsMenu(baseID) if int(command) == 4: sys.exit(0)
def mainMenu(baseID): print("---------------------------------------------------------------------") print("\nWELCOME, COURSE ADMIN!" + "\n" + "\n [1] Courses Menu" + "\n [2] Units Menu" + "\n [3] Students Menu" + "\n [4] Quit" ) command = promptCommand(1,4) if int(command) == 1: coursesMenu() if int(command) == 2: unitsMenu() if int(command) == 3: studentsMenu(baseID) if int(command) == 4: sys.exit(0)
def unitsMenu(): print("\nUNITS OPTIONS" + "\n" + "\n [1] Create Unit" + "\n [2] Search Unit" + "\n [3] Display All Units" + "\n [4] Display Students in Unit" + "\n [5] Edit Unit Details" + "\n [6] Delete Unit" + "\n [7] Filter Search students in unit" "\n [8] Back to Main Menu" ) command = promptCommand(1,8) if int(command) == 1: admin.createUnit(monash) unitsMenu() if int(command) == 2: admin.searchUnit(monash) unitsMenu() if int(command) == 3: admin.displayAllUnits(monash) unitsMenu() if int(command) == 4: admin.displayStudentsInUnit(monash) unitsMenu() if int(command) == 5: admin.editUnitDetails(monash) unitsMenu() if int(command) == 6: admin.deleteUnit(monash) unitsMenu() if int(command) == 7: admin.displayFilterStudentsInUnit(monash) unitsMenu() if int(command) == 8: mainMenu(baseID)
def coursesMenu(): print("\nCOURSES OPTIONS" + "\n" + "\n [1] Create Course" + "\n [2] Search Course" + "\n [3] Display All Courses" + "\n [4] Display Units in Course" + "\n [5] Edit Course Details" + "\n [6] Delete Course" + "\n [7] Display students in course with filter" + "\n [8] Back to Main Menu" ) command = promptCommand(1,8) if int(command) == 1: admin.createCourse(monash) coursesMenu() if int(command) == 2: admin.searchCourse(monash) coursesMenu() if int(command) == 3: admin.displayAllCourses(monash) coursesMenu() if int(command) == 4: admin.displayUnitsInCourse(monash) coursesMenu() if int(command) == 5: admin.editCourseDetails(monash) coursesMenu() if int(command) == 6: admin.deleteCourse(monash) coursesMenu() if int(command) == 7: admin.displayFilterStudentsInCourse(monash) coursesMenu() if int(command) == 8: mainMenu(baseID)
def displayFilterStudentsInUnit(self, university): print("\n \n \n") code = input("Enter a Unit code: ") if university.unitExists(code): unit = university.units[code] print("Please select your filters: ") print("Select study filter: ") print( "[1] - Full-time students \n[2] - Part-time students \n[3] - Either" ) command = promptCommand(1, 3) command = int(command) if command == 1: studType = 'F' elif command == 2: studType = 'P' else: studType = 'either' print("select residency filter: ") print( "[1] - Domestic students \n[2] - International students \n[3] - Either" ) command = promptCommand(1, 3) command = int(command) if command == 1: resType = 'D' elif command == 2: resType = 'I' else: resType = 'either' print("select degree type filter: ") print( "[1] - Undergraduate students \n[2] - Postgraduate students \n[3] - Either" ) command = promptCommand(1, 3) command = int(command) if command == 1: degType = 'U' elif command == 2: degType = 'P' else: degType = 'either' print("Displaying students in " + unit.getCode() + " with filters: ") print("Study Type = " + str(studType) + " | Residency Type = " + str(resType) + " | Degree Type = " + str(degType)) for studID in unit.students: currentStudent = university.students[studID] if currentStudent.getStudyType( ) == studType or studType == 'either': if currentStudent.getResidencyType( ) == resType or resType == 'either': if currentStudent.getDegreeType( ) == degType or degType == 'either': print(studID + " - Name: " + currentStudent.getName() + " course: " + str(currentStudent.getCourse())) else: print("ERROR: Unit code does not exist")
def createStudent(self, baseID, university): print("\n \n \n") print("ADDING A STUDENT TO UNIVERSITY:") courseCode = input("Enter a Course code: ") if university.courseExists(courseCode): newStudent = Student() newStudent.setID(str(baseID)) newStudent.setCourse(courseCode) lName = input("Enter a Last name: ") newStudent.setLName(lName) fName = input("Enter a First name: ") newStudent.setFName(fName) validDegType = False while not validDegType: degreeType = input("[U] Undergraduate / [P] Postgraduate: ") validDegType, degreeType = validator.validateDegreeType( degreeType) if validDegType: newStudent.setDegreeType(degreeType) else: print("ERROR: please enter either U or P") validResType = False while not validResType: residencyType = input("[D] Domestic / [I] International: ") validResType, residencyType = validator.validateResidencyType( residencyType) if validResType: newStudent.setResidencyType(residencyType) else: print("ERROR: please enter either D or I") validStudType = False while not validStudType: studyType = input("[F] Full-time / [P] Part-time: ") validStudType, studyType = validator.validateStudyType( studyType) if validStudType: newStudent.setStudyType(studyType) else: print("ERROR: please enter either F or P") print("Please enter Campus") print( "\n[1] - Clayton \n[2] - Caulfield \n[3] - Berwick \n[4] - Peninsula \n[5] - Parkville" ) command = promptCommand(1, 5) command = int(command) if command == 1: newStudent.setCampus('Clayton') elif command == 2: newStudent.setCampus('Caulfield') elif command == 3: newStudent.setCampus('Berwick') elif command == 4: newStudent.setCampus('Peninsula') elif command == 5: newStudent.setCampus('Parkville') else: print("ERROR ASSIGNING CAMPUS ") course = university.courses[courseCode] course.addStudent(newStudent.ID) university.addStudent(newStudent) university.addCourse(course) print("\nSUCCESS: STUDENT RECORD CREATED") newStudent.displayDetails() return baseID + 1 else: print("ERROR: Course code does not exist") return baseID print("\n \n \n")
def createStudent(self,baseID,university): print("\n \n \n") print("ADDING A STUDENT TO UNIVERSITY:") courseCode = input("Enter a Course code: ") if university.courseExists(courseCode): newStudent = Student() newStudent.setID(str(baseID)) newStudent.setCourse(courseCode) lName = input("Enter a Last name: ") newStudent.setLName(lName) fName = input("Enter a First name: ") newStudent.setFName(fName) validDegType = False while not validDegType: degreeType = input("[U] Undergraduate / [P] Postgraduate: ") validDegType, degreeType = validator.validateDegreeType(degreeType) if validDegType: newStudent.setDegreeType(degreeType) else: print("ERROR: please enter either U or P") validResType = False while not validResType: residencyType = input("[D] Domestic / [I] International: ") validResType, residencyType = validator.validateResidencyType(residencyType) if validResType: newStudent.setResidencyType(residencyType) else: print("ERROR: please enter either D or I") validStudType = False while not validStudType: studyType = input("[F] Full-time / [P] Part-time: ") validStudType, studyType = validator.validateStudyType(studyType) if validStudType: newStudent.setStudyType(studyType) else: print("ERROR: please enter either F or P") print("Please enter Campus") print("\n[1] - Clayton \n[2] - Caulfield \n[3] - Berwick \n[4] - Peninsula \n[5] - Parkville") command = promptCommand(1,5) command = int(command) if command == 1: newStudent.setCampus('Clayton') elif command == 2: newStudent.setCampus('Caulfield') elif command == 3: newStudent.setCampus('Berwick') elif command == 4: newStudent.setCampus('Peninsula') elif command == 5: newStudent.setCampus('Parkville') else: print("ERROR ASSIGNING CAMPUS ") course = university.courses[courseCode] course.addStudent(newStudent.ID) university.addStudent(newStudent) university.addCourse(course) print("\nSUCCESS: STUDENT RECORD CREATED") newStudent.displayDetails() return baseID + 1 else: print("ERROR: Course code does not exist") return baseID print("\n \n \n")