Question 1: COS1511 Assignment 3 BMI Calculator
Output:
Input:
#include <iostream>
using namespace std;
float getData(float &mass,float &height)
{
cout<<"Enter your mass in kilograms(kg): "<<endl<<endl;
cin>>mass;
cout<<"Enter your height in metres (m): "<<endl<<endl;
cin>>height;
return mass;
return height;
}
float calcBMI(float &mass,float &height)
{
float BMI;
, 12596388 Shivam Naik COS1511 Assignment 3 Unique Code 830235
float Square_height=height*height;
cout .setf(ios::fixed);
cout .precision(2);
BMI=mass/Square_height;
cout<<"Your BMI(Body Mass Index) in kg/m2 is: "<<BMI;
return BMI;
}
float displayFitnessResults(float &m,float &h, float &BMI)
{
if(BMI<18.5)
{
cout<<"Result of BMI:An Underweight Individual"<<endl<<endl;
cout<<"Please eat .........."<<endl<<endl;
}else if(BMI>=18.5&&BMI<=24.9)
{
cout<<"Result of BMI: Healthy Individual"<<endl<<endl;
cout<<"Continue the good work"<<endl<<endl;
}else if(BMI>=25.0&&BMI<=29.9)
{
cout<<"Result of BMI: An overweight individual"<<endl<<endl;
cout<<"Start Exercising and cutting off carbohydrates and saturated
,trans fats"<<endl<<endl;
}else if (BMI>30.0)
{
cout<<"Result of BMI:Obese ,Health emergency!"<<endl<<endl;