//HAM JING YI A19EC0048 990105029068     14/11/2019  SECTION 02
//CHUA CHEN WEI A19EC0038 990520115297   14/11/2019  SECTION 02
#include<iostream>
#include <iomanip>
using namespace std;

float getBMI(float w,float h)
{
	float BMI,overallBMI;
	BMI=w/(h*h);
	cout << "BMI    : "<<BMI<<endl;
	return BMI;
}
void dispStatus (float BMI)
{	
	if (BMI<18.5)
	cout <<"Status : Underweight\n\n"<<endl;
	else if (BMI<=25)
	cout <<"Status : Normal\n\n"<<endl;
	else if (BMI<30)
	cout <<"Status : Overweight\n\n"<<endl;
	else
	cout <<"Status : Obese\n\n"<<endl;
}

int main()
{	
	float w,h,H,BMI,OverallBMI,OverallW,OverallH;
	float totalW=0;
	float totalH=0;
	int num;
	char name[20];
	
	cout <<"Enter the number of person : ";
	cin >> num;
	
	for(int i=0;i<num;i++)
	{
	cout <<"Enter name => ";
	cin.ignore(1);
	cin.getline(name,20);
	cout <<"Enter weight(kg) and height(m) => ";
	cin >> w >>h;
	cout <<"\n\nName   : "<<name<<endl;
	cout << fixed <<setprecision(2);
	cout <<"Weight : "<<w<< " kilograms"<<endl;
	cout <<"Height : "<<h<< " meters"<<endl;
	BMI= getBMI(w,h);
	dispStatus (BMI);
	totalW+=w;
	totalH+=h;
	}
	OverallW=totalW/num;
	OverallH=totalH/num;
	OverallBMI= OverallW/(OverallH*OverallH);
	cout <<"Overall BMI :"<<OverallBMI<<endl;
	cout<<"Overall ";
	dispStatus (OverallBMI);
	
	return 0;
}	

