class Student:
stu_school='oldboy'
def __init__(self,x,y,z,w):
self.stu_name=x # 空对象.stu_name='egon'
self.stu_age=y # 空对象.stu_age=18
self.stu_gender=z # 空对象.stu_gender='male'
self.stu_number=w # 空对象.stu_gender='male'
# return None
def tell_stu_info(self):
print('学生信息:名字:%s 年龄:%s 性别:%s 学号:%s' %(
self.stu_name,
self.stu_age,
self.stu_gender,
self.stu_number
))
def set_info(self,x,y,z,w):
self.stu_name=x
self.stu_age=y
self.stu_gender=z
self.stu_number=w
def choose(self,x):
print('正在选择班级')
self.clas=x
stu1_obj=Student('egon',18,'male',111)
stu2_obj=Student('lili',19,'female',222)
stu3_obj=Student('jack',20,'male',333)
class Course:
cou_school = 'oldboy'
cou_adress = '虹桥'
def __init__(self, x,y,z):
self.cou_name=x
self.cou_price=y
self.cou_cycle=z
def tell_stu_info(self):
print('课程信息:名字:%s 价格:%s 周期:%s' %(
self.cou_name,
self.cou_price,
self.cou_cycle
))
def set_info(self,x,y,z):
self.cou_name=x
self.cou_price=y
self.cou_cycle=z
cou_obj1=Course('Python',20000,6)
cou_obj2=Course('Linux',20000,6)
class School:
name_school='oldboy'
def __init__(self, x, y):
self.sch_adress=x
self.sch_class=y
def tell_stu_info(self):
print('学校信息:地址:%s 班级数量:%s' %(
self.sch_adress,
self.sch_class
))
def set_info(self,x,y):
self.sch_adress=x
self.sch_class=y
def choose(self,x):
print('正在选择班级')
self.clas=x
sch_obj1=School('虹桥',16)
sch_obj2=School('张江',6)
class Teacher:
school_teach='oldboy'
def __init__(self, x,y,z):
self.tea_age=x
self.tea_salary=y
self.tea_level=z
def tell_stu_info(self):
print('教师信息:名字:%s 薪资:%s 等级:%s' %(
self.tea_age,
self.tea_salary,
self.tea_level
))
def set_info(self, x, y, z):
self.tea_age=x
self.tea_salary=y
self.tea_level=z
def choose(self,x):
print('正在给学生打分')
self.score=x
tea_obj1=Teacher('lxx',20000,6)
tea_obj2=Teacher('egon',50000,10)
tea_obj3=Teacher('tank',20000,6)
class SchoolClass:
adress_school='虹桥'
def __init__(self, x, y):
self.schcla_adress = x
self.schcla_class = y
def tell_stu_info(self):
print('班级信息:班级名称:%s 学生数量:%s' % (
self.schcla_adress,
self.schcla_class
))
def set_info(self, x, y):
self.schcla_adress = x
self.schcla_class = y
def choose(self,x):
print('正在选择课程')
self.course=x
schcla_obj1=SchoolClass('python十一期',76)
schcla_obj2=SchoolClass('python十二期',78)
# print(schcla_obj1.__dict__)
schcla_obj1.tell_stu_info()