/* Herthik A/L Prathaban ( A19EC0049 ) 
Nur Hadirah Munawarah Binti Rozmizan (A19EC0201) 000526-06--076 */


#include <iostream>
#include<iomanip>
using namespace std;

float getbmi(float weight,float height);
void dispstatus(float &bmi);

float getbmi(float weight,float height)
{
	float bmi;
	bmi=weight/(height*height);
	return bmi;
}
void dispstatus(float &bmi)
{
	if ((bmi >=18.5 )&& (bmi <=25))
	cout << "Status : Normal ";
	else if (bmi< 18.5)
	cout << "Status : Underweight ";
	else if ((bmi >25 )&& (bmi <=30))
	cout << "Status : Overweight ";
	else
	cout << "Status : Obese ";
	
}

int main()
{
	const int max=40;
	char name[max];
	
	float weight, height,totalweight=0,totalheight=0,totalbmi,totalperson=0,averageheight,averageweight;

	
cout << "Enter name or press <ENTER> key to end => ";
cin.getline(name,max);
	do{
if(name[0]!='\0')
{
	     
	cout << "Enter weight(kg) and height(m) => ";
	cin >> weight >> height;
	
	cout << fixed << setprecision(2);
	float bmi=getbmi(weight,height);
	
	cout << "\nName  : " << name;
	cout << "\nWeight : "<<weight << " kilograms ";
	cout << "\nHeight : "<< height << " meters ";
	cout << "\nbmi : "<< bmi;
	cout << endl;
	dispstatus(bmi);
	totalheight+=height;
	totalweight+=weight;
	totalperson++;
}
else
break;
	cout << "\n\n Enter name or press <ENTER> key to end =>  ";
	cin.ignore();
	cin.getline(name,max);	
	}while(name[0]!='\0');
	
	averageweight=totalweight/totalperson;
	averageheight=totalheight/totalperson;
	totalbmi=getbmi(averageweight,averageheight);
	
	cout<< "\nOveral bmi: "<<totalbmi;
	cout << endl;
	
	cout << "Overall ";
	dispstatus(totalbmi);
	
	
	
	 
	 return 0;
	
}
