//Alexander Dumervil //Project 4 String title = "Project 4"; String subtitle = "r for reset, q to quit\nb/s move big/small to end"; String author = " Alexander Dumervil"; int max = 20; float lex[] = new float [ max ]; void setup() { size(800, 800); reset(); } void draw() { background( 20, 255, 150); fill(0); float x = 200, y = 20; for ( int i = 0; i < max; i++) { text(lex[i], x, y); y = y + 12; } textSize(20); text( title, width/2, 20); textSize(12); text( subtitle, width/2, 50); text(author, width-200, height-20); } void reset() { for ( int i = 0; i < max; i++) { lex[i] = random(0, 5000000); } } void big(){ //move biggest to the end of array int k=0; // Start with first one. // Find index of biggest. for (int j=0; j lex[k]) { // Found a bigger one! k= j; // Change the index k } } // k is now the index of the biggest! // // Move it to end. float tmp= lex[max-1]; // Save the old END value. lex[max-1]= lex[k]; lex[k]= tmp; } void small(){ //move small to end of array. int k=0; // Start with first one. // Find index of smallest. for (int j=0; j