/* AINA ALIAH BINTI RUSLAN
   IMRAN HAKIM BIN NORASMADI
   (SECTION 2) */
#include <iostream>
#include <cctype>
#include <iomanip>
#define MAX 100
using namespace std;

float getBMI (float Weight , float Height )
{ 
    float BMI;
    
	BMI = Weight /( Height * Height ) ;
    
	return BMI;
   
   	
} 

void dispStatus ( float BMI )
{
	if ( BMI < 18.5 )
	   cout << "Status : Underweight" << endl;
	   
	else if ( BMI <= 25.0)
	   cout << "Status : Normal" << endl;
	   
	else if ( BMI <= 30)
	   cout << "Status : Overweight" << endl;
	   
	else 
	cout << "Status : Obese" << endl;
	
	cout << endl;
}


int main ()
{
	int n=0;
	char name [MAX];
	float weight, height ,totalweight, totalheight, avgweight, avgheight, overallBMI, BMI;
	cout << fixed << setprecision (2);
	
	while(1) 
	{
		cout << "Enter name or press <ENTER> key to end => ";
	    if ( n > 0)
	    cin.ignore();
		cin.getline(name,MAX);
		
		if (isalpha(name[0])){
		
		n++;
		cout << "Enter weight (kg) and height (m) => ";
		cin >> weight >> height;
		
		cout << "\nName   : " << name << endl;
		cout << "Weight : " << weight << " kilograms" << endl;
		cout << "Height : " << height << " meters" << endl;
		BMI = getBMI( weight , height);
		cout << "BMI    : " << BMI << endl;
	    dispStatus(BMI);
		
		totalweight += weight;
		totalheight += height;
		
		}
		
		else
		break;
	 
	}
		
	avgweight = totalweight / n;
	avgheight = totalheight / n;
	
	overallBMI = avgweight / ( avgheight * avgheight );
	
	cout << "\n\nOverall BMI : " << overallBMI << endl;
	cout << "Overall "; 
	dispStatus(overallBMI) ;
	
	return 0;
	
	
}
