# Elective system in the project involves a lot of data and functions, it requires the introduction of object-oriented thinking its highly integrated
# # 1, school data and functional integration
# # 2, course data and function integration
# # 3, student data and functions integration
# # 4, lecturer and functional data integration
# # 5, class data and function integration
# ps: students can not write, you can use an ordinary way, first gave written data and functions, and then consider based on the integration of object-oriented thinking
#
# data section:
class School: # Campus names: such as "Old Boy Shanghai Campus" # Campus Address: such as "Shanghai Hongqiao" DEF __init__ (Self, name, address): self.name = name self.address = address DEF schoolinfo (School_obj) : Print ( ' school info: name:% s Campus:% s ' % ( School_obj.name, School_obj.address )) # Once created campus, you can create a class for each campus DEF new_Class (School_obj, Classname): School_obj. new_Class = Classname
class Class: # Class Name # campus where classes DEF the __init__ (Self, name, School): the self.name = name self.school = School DEF Classlinfo (CLASS_OBJ): Print ( ' class information: Name:% s Campus:% s ' % ( Class_obj.name, Class_obj.school )) # after the class is created, you can create a course for each class DEF new_Course (CLASS_OBJ, course,): Class_obj.new_Course = course,
class Student: # student school # student's name # age of the student # Student ID # Student sex DEF __init__ (Self, School, name, Age, Number The, Sex): self.school = School self.name = name Self. Age = Age self.number = number The self.sex = sex DEF Classlinfo (Student_obj): Print ( ' student information: school:% s name:% s Age:% s student ID:% s gender:% s ' % ( Student_obj.school, Student_obj.name, Student_obj.age, Student_obj.number, Student_obj.sex )) # after the student has been created, students can choose classes DEF choose_Class (Student_obj, Classname): Student_obj.choose_Class = Classname Print (Student_obj.choose_Class)
class Course,: # Course name # curriculum cycle # Course prices DEF __init__ (Self, name, Time,. price): self.name = name self.time = Time self.price = . price DEF Classlinfo (Course_obj): Print ( ' course information : course name:% s cycle:% s price:% s ' % ( Course_obj.name, Course_obj.time, Course_obj.price, ))
class Teacher: # the name of the teacher # Teacher's age # salary teachers # teacher's grade DEF __init__ (Self, name, Age, salarys, Level): self.name = name self.age = Age self.salarys = salarys Self. level = level DEF Classlinfo (Teacher_obj): Print ( ' teacher information: name:% s Age:% s salary:% s rating:% s ' % ( Teacher_obj.name, Teacher_obj.age, Teacher_obj.salarys, Teacher_obj.level )) # After the teacher has been created, students can score DEF give_rate (Teacher_obj, studentName, Rate): Teacher_obj.give_rate = Rate #