#include <iostream>
#include <stdlib.h>
#define N 90
using namespace std;
class inertia{
	
private:
double m;
double x;
double y;
double z;
int code;

public:

//default constructor 	
inertia()
{m=0.0; x=0.0; y=0.0; z=0.0; code=-1;}

//CONSTRUCTOR WITH LIST OF PARAMETERS
inertia(double in_m, double in_x, double in_y, double in_z, int in_code)
{ m=in_m; x=in_x; y=in_y; z=in_z; code=in_code;}

void print()
{cout<<m<<"  "<<x<<"  "<<y<<"   "<<z<<"   "<<code<<endl;	}	
	
double get_m()   {return m;}
double get_x()   {return x;}
double get_y()   {return y;}
double get_z()   {return z;}
int get_code()   {return code;}
	
};  // end class inertia definition

int main()
{ double in_m, in_x, in_y, in_z,   sum=0.0; 
int i, in_code;
inertia a[N];
int count[10]={0};
double sum_xoy[10]={0.0}, sum_yoz[10]={0.0}, sum_zox[10]={0.0};
//   srand
// initialize array a[N]
for (i=0;i<N;i++)    a[i]=inertia();
// display values
for (i=0;i<N;i++)    a[i].print();

for (i=0;i<N;i++)
{
in_m=(rand()%10)*1.0;
in_x=(rand()%100)*1.0;
in_y=(rand()%100)*1.0;
in_z=(rand()%100)*1.0;
in_code=(rand()%10);
	
// RHTH (EXPLICIT CALL ) KLHSH TOY CONSTRUCTOR WITH PARAMETERS' LIST 
a[i] = inertia(in_m,in_x,in_y,in_z,in_code);
}
cout<<"------------------------------------------------------------"<<endl;
// display real values !!!!!
for (i=0;i<N;i++)    a[i].print();

// ERWTHMA 3
 for (i=0;i<N;i++)
 {count[a[i].get_code()]++; }
 for (i=0;i<N;i++)
 {
 	sum_xoy[a[i].get_code()]+=a[i].get_m()*a[i].get_z()*a[i].get_z();
 	sum_yoz[a[i].get_code()]+=a[i].get_m()*a[i].get_x()*a[i].get_x();
 	sum_zox[a[i].get_code()]+=a[i].get_m()*a[i].get_y()*a[i].get_y();
 }
 
 for (i=0;i<10;i++)
 if (count[i]>=5)  cout<<i<<"  "<<sum_xoy[i]<<"   "<<sum_yoz[i]<<"    "<<sum_zox[i]<<endl;

return 0;
}
