class student:
def __init__(self,name,age,weight,height):
self.name = name
self.age = age
self.weight = weight
self.height = height
def display(self):
print(self.name, end = " ")
print(self.age, end = " ")
print(self.weight, end = " ")
print(self.height, end = " ")
print()
def get_weight(self):
return self.weight
def get_height(self):
return self.height
def setup():
a = student("Buntun",18,50,160)
b = student("FlukeKnub",19,75,199)
c = student("PeeJa",19,60,160)
d = student("Nutdech",18,58,185)
e = student("BasBomba",20,60,180)
a.display(),print(cal_bmi(a))
print()
b.display(),print(cal_bmi(b))
print()
c.display(),print(cal_bmi(c))
print()
d.display(),print(cal_bmi(d))
print()
e.display(),print(cal_bmi(e))
print()
def cal_bmi(student):
bmi = student.get_weight()/((student.get_height()/100)*(student.get_height()/100))
return bmi
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น