A. Introduction

Now that your array is filled with random height data. How to find average height? Maximum or minimum height?

B. Watch ... (Slides)

C. Now, open your code in 6.2, complete:

Print out the average height

Print out the maximum and minimum height

You can try R7.9 too...

D. Check how well you can score, and see if you can find out what are wrong in these slides.

import java.util.Scanner;

class MaxMin {

public static void main(String[] args) {

Scanner Oscar = new Scanner(System.in);

System.out.println("Please enter the number of elements you will have in the array");

int numberof = Oscar.nextInt();

double[] MiniMax = new double[numberof];

for(int i=1; i<=numberof; i++){

System.out.println("Please enter one element of the array");

MiniMax[i-1] = Oscar.nextDouble();

}

double Max = MiniMax[0];

for(int i=1; i<=numberof-1; i++){

if(MiniMax[i]>Max){

Max = MiniMax[i];

}

}

System.out.println("The greatest number in that array is " + Max);

double Min = MiniMax[0];

for(int i=1; i<=numberof-1; i++){

if(MiniMax[i]<Min){

Min = MiniMax[i];

}

}

System.out.println("The smallest number in that array is " + Min);

}

}