clc
clear all
disp('ABSTRACT')
% Programmer: D. Miller
% purpose:    To find a person's bmi
disp('  BMI example')
disp(' ')
% inputs
disp('INPUTS')
w  =180
h  =72
% BMI CALCULATION
bmi=(w/h^2)*703;
bmi=round(bmi);
% CODE/OUTPUTS
disp(' ')
disp('OUTPUTS')
fprintf('  Your BMI is %g\n',bmi)

% Part a)
disp(' ')
disp('Part a)')
if bmi>25 | bmi<19
    disp('  This is an unhealthy BMI')
else
    disp('  This is a healthy BMI')
end

% Part b)
disp(' ')
disp('Part b)')
if bmi<19
    flag=0;
end
if bmi<=25 & bmi>=19
    flag=1;
end
if bmi>25 & bmi<=30
    flag=2;
end
if bmi>30
    flag=3;
end
flag
% part c)
disp(' ')
disp('Part c)')
if flag==0
    disp('  underweight')
    tw=ceil((19*h^2)/703);
    fprintf('  Your target weight is %g\n',tw)
end
if flag==1
    disp('  healthy')
    disp('  maintain your weight')
end
if flag==2
    disp('  overweight')
    tw=floor((25*h^2)/703);
    fprintf('  Your target weight is %g\n',tw)
end
if flag==3
    disp('  obese')
    tw=floor((25*h^2)/703);
    fprintf('  Your target weight is %g\n',tw)
end
