def pay_tuition(): print("选择学生:") data.print_students() student_name = input("学生名:") student = data.get_student(student_name) if student == None: print("学生选择错误") return money = input("请输入学费金额:") if not money.isdigit(): print("输入金额不正确") return student.pay_tuition(int(money)) data.update_student(student)
def choose_school(): print("选择学生:") data.print_students() student_name = input("学生名:") student = data.get_student(student_name) if student == None: print("学生选择错误") return print("选择学校:") data.print_schools() school_name = input("学校名:") school = data.get_school(school_name) if school == None: print("学校选择错误") return student.choose_school(school) data.update_student(student) data.update_school(school)
def choose_grade(): print("选择学生:") data.print_students() student_name = input("学生名:") student = data.get_student(student_name) if student == None: print("学生选择错误") return print("选择班级:") data.print_grades() grade_name = input("班级名:") grade = data.get_grade(grade_name) if grade == None: print("班级选择错误") return student.choose_grade(grade) data.update_student(student) data.update_grade(grade)
def add_student(): print('填写学生信息') stu_name = input('学生姓名') print('选择学校') data.print_schools() sch_name = input('学校') school = data.get_school(sch_name) if school == None: print("学校选择错误") return print("选择班级:") data.print_grades() grade_name = input("班级名:") grade = data.get_grade(grade_name) if grade == None: print("班级选择错误") return student = education.Student(stu_name, school, grade) data.update_student(student) data.update_school(school) data.update_grade(grade)
def modify_score(): print('选择老师') data.print_teachers() teacher_name = input('姓名:') teacher = data.get_teacher(teacher_name) if teacher == None: print("老师选择错误") return print('选择学生') data.print_students() student_name = input('学生名:') student = data.get_student(student_name) if student == None: print("学生选择错误") return score = input("请输入分数:") if not score.isdigit() or 0 > int(score) or int(score) > 120: print("输入分数不正确") return teacher.modify_score(teacher, student, score) data.update_teacher(teacher) data.update_student(student) data.update_grade(teacher.grade) print("%s 的成绩修改为: %s" % (student.name, data.get_student(student_name).score))