so I have a project that is pretty straight forward. It's a simple BMI calculator and should just simply print,
"The BMI for (name) is (BMI), (status, like if they're underweight, overweight etc.)
name = str(input("What is your name? "))
age = int(input("What is your age? "))
weight_float = float(input("What is your weight in pounds? "))
height_float = float(input("What is your height in inches? "))
Pounds2Kilogram = weight_float * 0.453592
Inches2Meter = height_float * 0.0254
weight = Pounds2Kilogram
height = Inches2Meter
class calcBMI:
def __init__(self, name, age, weight, height):
self.__name = name
self.__age = age
self.__weight = weight
self.__height = height
def getBMI(self):
return self.__weight / (self.__height **2)
def getStatus(self):
if BMI < 18.5:
self.__getStatus = "Underweight"
elif 18.5 < BMI < 24.9:
self.__getStatus = "Normal"
elif 25.0 < BMI < 29.9:
self.__getStatus = "Overweight"
elif BMI > 30:
self.__getStatus = "Obese"
def getName(self):
return self.__name
def getAge(self):
return self.__age
def getWeight(self):
return self.__weight
def getHeight(self):
return self.__height
def __str__(self):
return "The BMI for", + self.__name(), + "is", + self.__getBMI()
def PrintBMI(self):
print(self.__str__())
a = caclBMI
print(a)
I keep getting:
<class '__main__.calcBMI'>
I know that means I need to convert the object to a string and I'm sure I'm missing something simple.
Thanks for helping if you do so choose to.