// Lorenzo Seda // CST 112 // How to create arrays. Project 5. Work In Progress. float [] a = {100,35,150,30,70}; int many=a.length; int nextX, nextY; final int FIRSTX=10,FIRSTY=30,SPACING=12; float multiplier; float big=150; void setup() { size(800,480); //// int[] a= new int[] { 100, 35, 150, 30, 70 }; int big; int many= a.length; // Find the biggest number. big= a[0]; for (int j=0; j big) big= a[j]; } // Output the result. println("Biggest: "+big); fill(0,0,0); text("Biggest value in array: ", 10,50); text(big, 10,62); } void draw() //Draw a frame { multiplier= (width-90) / big; scene(); show(); } void scene() { background(255,255,200); /// This is the Sort Array box, this box will command the arrays to be sorted. fill(140,155,140); rect(55,355,100,70); fill(0); text("Sort Arrays",75, 370, 100,70); // This is the fill array box, i'm assuming that this will give random numbers. fill(90,140,90); rect(255,355,100,70); fill(0); text("Fill Arrays",275, 370, 100,70); } void show() //// Show all elements of the array. { nextX = FIRSTX; nextY =FIRSTY; for(int j=0; j1 ) { //// Find biggest and move it to the end. int k= whereBig( a, n ); swap( a, k, n-1 ); // Move biggest to end. n--; // Now, shrink the array. } } int whereBig( int a[], int n ) { //// Return index of biggest. int w= 0; //// Start with first element. for (int j=1; j a[w]) w= j; } return w; } void swap( int a[], int i, int j ) { //// Swap 2 elements of an array. int tmp; tmp= a[i]; a[i]= a[j]; a[j]= tmp; } void showArray( int a[], int many) { //// Show the array int x=10, y=100; // Print and display for (int j=1; j