CST 112 Final Exam
based on Project 8

AVERAGES
  • Add a row at the bottom of the table, to display the mean average (μ) of each property (column).
  • You will need a new set of global variables, to hold averages for each property.
  • Calculate all of these mean averages whenever the properties are changed
            (e.g. when the reset() or next() methods are called (but NOT when sorting occurs!)

    PROPERTIES:  Add these properties to the Person object (or add arrays, if you have no class ;^>):

          wtdiff      // A value equal to the difference between wt and average wt (μwt)
          wtdiff2     // The square of wtdiff 
    Be sure to adjust "wtdiff" and "wtdiff2" whenever the wt property is changed
    e.g. when the reset() or next() methods are called, but NOT when sorting occurs!
    (It is not necessary to recompute wtdiff unless the "wt" properties change.)

    If  wtavg  is a global variable that contains the mean average of all of the wt properties, then code to set the diff and diff2 values might look something like this:
    
    for (int j=0; j<many; j++) {
    	jones[j].diff=  jones[j].wt - wtavg ; 
    	jones[j].diff2=  sq( jones[j].wtdiff );
    }


    BUTTONS:  Add the following buttons, and perform the specified actions when the button is clicked.
    Make each button a different color, with its name in a contrasting color.



    Upload your source code into your folder as a file named:  "final.java".
    See previous projects for requirements regarding readability and coding standards, including:  modularization, parameterization, indentation, appropriate naming, commenting, etc. (and be sure to start each method with a comment that says what you are trying to do!)
    Make sure your code compiles; files with syntax errors will not be graded!


    GRADING RUBRIC:
    
    AVGS 	Average computed and displayed for each property.
    DIFF2	Values (diff, diff2) computed and displayed for each row.
    Table	(Display a table of values)
    Show	(Display some people)
    
    Buttons	Working buttons
    RN	Reset (random values), Next (age++, adjust properties)
    WW	Display skinniest & fattest
    Sigma	Calculate sigma, display it
    Birds	Flock of birds (random number) flies when clicked
    
    Objects	Class definition, consturctors, etc.
    Coding	Coding, readability, etc. 
    
    
    
    String[] cats= { 
    	"AVGS",	  "DIFF",	"Table","Show",	
    	"Buttons","R/N",	"WW",  	"Sig",	"Birds",  	
    	"Objects","Coding" 
    };
    int points[]= {
    	0,		0,	0,	0,	
    	0,  		0,	0,  	0,	0,  	
    	0,  		0 
    };
    void grading() {
      //// Display grading for exam ////
      int x=width/4, y=height-30, total=0;
      fill(0);
      for (int i=0; i0) text( points[i], x, y+15 );
        total += points[i];
        x += 50;
      }
      fill(255,0,0);
      x += 20;
      text( "TOTAL", x, y );
      if (total>0) text( total, x, y+15 );
    }
    /* ADD:
      draw() {
                  grading()
    */