#include<iostream>
#include<cstring>
#include<iomanip>
#include<cctype>


using namespace std;

float getBMI(float x, float y)
{
	return x/(y*y);
	
}

void dispStatus(float gg)
{
    if(gg<18.5)
	cout<<"status : Underweight \n";
	
	else if (gg<=25)
	cout<<"status : Normal\n ";
	
	else if(gg<30)
	cout<<"status : Overweight \n";
	
	else
	cout<<"status : Obese \n";	
}

void displayOverallBMI(float kk)
{
	if(kk<18.5)
	cout<<"overall status : Underweight \n";
	
	else if (kk<=25)
	cout<<"overall status : Normal\n ";
	
	else if(kk<30)
	cout<<"overall status : Overweight \n";
	
	else
	cout<<"overall status : Obese \n";	
}

int main ()
{
    
	float w,h,status,overallBMI,totalHeight=0,totalWeight=0,overallHeight,overallWeight;
	int num =0;
	char name[50];
	
	
	
	cout<<"Enter name or press <ENTER> key to end => ";
	cin.getline(name,50);
	
	while (isalpha(name[0]))
	{
	num ++;
	
	cout<<"Enter weight (kg) and height (m) => ";
	cin>>w>>h;
	
	status=getBMI(w,h);
	
	cout<< fixed << setprecision(2);
	cout<<"\nName   : "<<name<<endl
	    <<"Weight : "<<w<< " kilograms "<<endl
	    <<"Height : "<<h<< " meters "<<endl
	    <<"BMI    : "<<status<<endl;
	
	totalWeight+=w;
    totalHeight+=h;
	
	dispStatus(status);
	
    cout<<"\nEnter name or press <ENTER> key to end => ";
    cin.ignore();
	cin.getline(name,50);
	  
	
    }

//overall BMI

	overallHeight=totalHeight/num;
	overallWeight=totalWeight/num;

    
    overallBMI=overallWeight/(overallHeight*overallHeight);
    
    cout<<"\nOverall BMI: "<<overallBMI<<endl;
    
    displayOverallBMI(overallBMI);
    
	return 0;   
    
}
