diff --git a/OOP/myclass.py b/OOP/myclass.py index ae3604b..b46d6c5 100755 --- a/OOP/myclass.py +++ b/OOP/myclass.py @@ -1,20 +1,31 @@ #!/usr/bin/env python +class myClass(): + #constructor + def __init__(self, username, eyecolor, height, weight, age, birthdate): + self.username = username + self.eyecolor = eyecolor + self.height = height + self.weight = weight + self.age = age + self.birthdate = birthdate + + #name printing method + def myMethod(self): + print("Hi,", self.username) + + #bmi calculator and printer + def bmi(self): + conversion = (self.height/10) + (4/12) + bmimath = (conversion*4.88/self.height*self.height) + print("{}, your BMI is: {}".format(self.username, bmimath)) + -class myClass: - name = "Dan" - eyes = "blue" - height = 54 - weight = 165 - age = 34 - birth = 040277 - def myMethod - print "Hi %s", % (name) - -me = myClass - -print me.eyes -print me.age -print me.weight -print me.birth +dan = myClass("Dan", "Blue", 54, 165, 34, "04/02/77") +dan.myMethod() +print("Eyecolor:", dan.eyecolor) +print("Age:", dan.age) +print("Weight:", dan.weight) +print("Birth Date:", dan.birthdate) +print("Height:", dan.height)