forked from suvasish/BmiCalculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbmi_engine.py
43 lines (27 loc) · 1.15 KB
/
bmi_engine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
__author__ = 'suvasish'
import sys
from bmi_calculation import Bmi
from user_input import UserInput
from bmi_category import BmiCategroy
class BmiEngine:
def __init__(self):
pass
bmi = Bmi()
input = UserInput()
category = BmiCategroy()
def start_bmi(self):
gender = self.input.get_gender()
age = self.input.get_age()
if age < 20: sys.exit("EXIT: Please use 'BMI Calculator for Child and Teens'")
height, height_unit = self.input.get_height()
weight, weight_unit = self.input.get_weight()
bmi_ = self.bmi.calculate_bmi(height, height_unit, weight, weight_unit)
print("Your BMI: %s" % bmi_)
recommended_weight = self.bmi.recommend_weight(height, height_unit)
print("Weight Range: Min - %s Max - %s" % (recommended_weight[0], recommended_weight[1]))
bfp = self.bmi.body_fat_percent(_gender=gender, _bmi= bmi_, _age=age)
print("Boby Fat Percentage: %s" % bfp)
bfp_category = self.bmi.body_fat_category(_bfp=bfp, _gender=gender)
print("Boby Fat Percentage Category: %s" % bfp_category)
bmi_engine = BmiEngine()
bmi_engine.start_bmi()