String columns[]= {"NAMES", "AGE", "HEIGHT", "WEIGHT", "BMI"}; String names[]= {"John", "Mike", "Josh", "Philip", "Steve", "Harry", "Tyler", "Dylan", "Justin", "Chris"}; int age[]= {19, 25, 38, 41, 27, 64, 52, 34, 77, 36}; int ht[]= {64, 71, 68, 78, 69, 72, 58, 66, 63, 62}; int wt[]= {156, 210, 177, 145, 182,196, 224, 123, 189, 126}; //objects bodies[] subjects; int people = names.length; void setup(){ smooth(); size(800,800); initialize(); } void draw(){ background(219,200,184); table(); instructions(); showpeople(); longndirty(); } void initialize(){ //creates people subjects= new bodies[people]; int s=0; int l=50; for (int p=0; p1; m-- ) { w=0; //// Index of biggest for (int i=1; i a[w]) w=i; } swapall( w, m-1 ); } } void sortby( String[] s, int people ) { //// Sort all string //// Find greatest age, move to end. int m; int w; for (m=people; m>1; m-- ) { w=0; for (int i=1; i 0 ) w=i; } swapall( w, m-1 ); } } void swapall( int j, int k ) { //// Swap arrays swap( names, j, k ); swap( age, j, k ); swap( wt, j, k ); swap( ht, j, k ); } void swap( int[] a, int j, int k ) { //swap ints int temp; temp= a[j]; a [j] = a[k]; a[k]= temp; } void swap( String[] a, int j, int k ) { ////swap strings String temp; temp= a[j]; a [j] = a[k]; a[k]= temp; } //classes class bodies{ //constructors float x=0; float y=0; float w=0; float h=0; color shirtcolor = color(0); bodies(float x, float y, float w, float h){ this.x=x; this.y=y; this.w=w; this.h=h; } //methods void show(){ strokeWeight(0); fill(shirtcolor); //body ellipse(x,y,w,h); //head fill(247,188,140); ellipse(x,y-h/2-7,14,14); fill(0); strokeWeight(2); point(x-2,y-h/2-9); point(x+2,y-h/2-9); //arms and legs strokeWeight(2); line(x-5,y+h/2,x-5,y+h/2+5); line(x+5,y+h/2,x+5,y+h/2+5); line(x-w/2,y,x-w/2-5,y+3); line(x+w/2,y,x+w/2+5,y+3); } } void longndirty(){ ///sorts bodies long and dirty way if (key=='a'){ subjects[0].x = 50; subjects[1].x = 125; subjects[2].x = 425; subjects[3].x = 500; subjects[4].x = 200; subjects[5].x = 650; subjects[6].x = 575; subjects[7].x = 275; subjects[8].x = 725; subjects[9].x = 350; } if (key=='h'){ subjects[0].x = 275; subjects[1].x = 575; subjects[2].x = 425; subjects[3].x = 725; subjects[4].x = 500; subjects[5].x = 650; subjects[6].x = 50; subjects[7].x = 350; subjects[8].x = 200; subjects[9].x = 125; } if (key=='w'){ subjects[0].x = 275; subjects[1].x = 650; subjects[2].x = 350; subjects[3].x = 200; subjects[4].x = 425; subjects[5].x = 575; subjects[6].x = 725; subjects[7].x = 50; subjects[8].x = 500; subjects[9].x = 125; } if (key=='n'){ subjects[0].x = 275; subjects[1].x = 500; subjects[2].x = 350; subjects[3].x = 575; subjects[4].x = 650; subjects[5].x = 200; subjects[6].x = 725; subjects[7].x = 125; subjects[8].x = 425; subjects[9].x = 50; } }