PROJECT 8:

NOTE: See projects.html for general requirements of all projects.

Create a class named Person, with the following object properties:

	name	 // a String containing this person's name 
	age	 // an integer representing the age of the person
	ht	 // an integer representing height, in inches. 
	wt	 // an integer representing weight, in pounds. 
	bmi	 // a float, representing BMI (Quetlet body-mass-index). 
	r,g,b	 // three integers, specifying RGB color values for display. 

and the following object methods:

	void show( float x, float y)  {
	  // Display a rectangle centered at (x,y), with circular "head" on top.
	  //(Extra credit for adding two eyes, a nose, and a mouth.  :-)
	  //
	  // Use the r,g,b, and ht values to set the color and height displayed.
	  // Make rect height proportional to ht and fill it with color(r,g,b).
	  // Display the name in BLACK, starting within the rectangle.
	  /*
		ADD YOUR CODE HERE.
	  */ 
	}
	void reset( )  {
	  // Change age, ht, wt, and r,g,b to random values (up to 255).
	  // Random values for age should range from 10 to 100.
	  // Random VAlues for ht should range from 40 to 80.
	  // Random values for wt should range from 50 to 300.
	  /*
		ADD YOUR CODE HERE.
	  */
	}
	void next( )  {
	  // Increase age by one, adjust the ht and wt as follows, then recalculat bmi.
	  //
	  // Adjust the wt by plus or minus 20% ( multiply by a random number from 0.8 to 1.2 )
	  // If age is under 25, increase ht by up to 10% ( 1.0 to 1.1 ).
	  // If age is over 50, decrease ht by up to 5% ( 0.95 to 1.0 ).
	  /*
		ADD YOUR CODE HERE.
	  */
	  calcbmi();
	}
	void calcbmi() {
	  //// Recalculate the BMI = 703 * wt / ht2 
	  bmi =    703.0 * wt / pow(ht,2);
	}

Also have a one-argument constructor as follows:

	Person( String setname ) {
	  // One-argument constructor -- initializes the name.
	  this.name = setname;
	}

Create an array of ten Person objects, and name the array after YOURSELF.
Your array name MUST be the first three (or more) letters of YOUR last name (all lower-case) .

In the setup() function:
construct each object with a different String for its name property. Also initialize each object by calling the reset() method for each array element, to set random colors (r,g,b) and random values for age, height, weight, as described above.

In the draw() function:
call two separate functions to perform the following tasks:

Use keyPressed() and/or mousePressed() functions to handle events:
The following actions are performed ONLY ONCE, immediately after a specified event (key-press or button-click).
(Note that the draw() method is not involved in these actions!)

Key (or button) ACTION
"A" sort array in ascending order by age values.
"B" sort array in ascending order by bmi values.
"H" sort array in ascending order by ht values.
"+" call next() for each object, to increase age and readjust ht, wt, and bmi.
"R" reinitialize all objects to new (random) values, by calling the reset() method for each one.


For the final exam ( "final.html" ), you will begin with a copy of Project 8, and add some additional code to modify properties of objects in the array.