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 wtdiffBe sure to adjust "wtdiff" and "wtdiff2" whenever the wt property is changed
If wtavg is a global variable
that contains the mean average of all of the wt properties,
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.
RESET |
---|
NEXT |
---|
Weight Watchers |
---|
"SIGMA"
σ |
---|
STATISTICS REVIEW:
The "standard-deviation" (σ) is the square-root of the variance (σ²). For the wt property, the variance (σ²) is the mean average of the "wtdiff2" values. Add up all of the values for "wtdiff2", and divide by the number of values (many=10), to get the variance. Note that each wtdiff value is the wt value minus wtavg, and each wtdiff2 value is sq(wtdiff). |
BIRDS |
---|
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. 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() */