import java.util.*;

public class LakeTest {

	public static void main(String[] args) {

		// Create lake, create its data: (depth, temperature, oxygen conc)
		Observation[] Nepessing = new Observation[11];
		Nepessing[0] = new Observation(0, 23, 15);
		Nepessing[1] = new Observation(1, 23, 14);
		Nepessing[2] = new Observation(2, 23, 14);
		Nepessing[3] = new Observation(3, 22, 14);
		Nepessing[4] = new Observation(8, 20, 14);
		Nepessing[5] = new Observation(9, 20, 15);
		Nepessing[6] = new Observation(10, 19, 14);
		Nepessing[7] = new Observation(12, 12, 7);
		Nepessing[8] = new Observation(18, 11, 7);
		Nepessing[9] = new Observation(23, 10, 7);
		Nepessing[10] = new Observation(29, 10, 6);

		Observation[] Hadley = new Observation[11];
		Hadley[0] = new Observation(0, 24, 12);
		Hadley[1] = new Observation(2, 24, 12);
		Hadley[2] = new Observation(4, 23, 13);
		Hadley[3] = new Observation(6, 20, 10);
		Hadley[4] = new Observation(8, 21, 11);
		Hadley[5] = new Observation(10, 17, 9);
		Hadley[6] = new Observation(12, 13, 5);
		Hadley[7] = new Observation(14, 13, 4);
		Hadley[8] = new Observation(16, 12, 4);
		Hadley[9] = new Observation(18, 12, 4);
		Hadley[10] = new Observation(20, 12, 3);

		Observation[] Ortonville = new Observation[9];
		Ortonville[0] = new Observation(0, 26, 11);
		Ortonville[1] = new Observation(1, 25, 11);
		Ortonville[2] = new Observation(2, 24, 11);
		Ortonville[3] = new Observation(4, 24, 10);
		Ortonville[4] = new Observation(5, 23, 11);
		Ortonville[5] = new Observation(8, 20, 10);
		Ortonville[6] = new Observation(9, 17, 9);
		Ortonville[7] = new Observation(11, 17, 9);
		Ortonville[8] = new Observation(13, 17, 10);

		Observation[] Fish = new Observation[7];
		Fish[0] = new Observation(0, 23, 8);
		Fish[1] = new Observation(3, 24, 8);
		Fish[2] = new Observation(5, 22, 7);
		Fish[3] = new Observation(8, 15, 4);
		Fish[4] = new Observation(10, 16, 3);
		Fish[5] = new Observation(13, 15, 3);
		Fish[6] = new Observation(15, 14, 2);

		// Place lakes in ArrayList as required by homework
		ArrayList lakes = new ArrayList();
		lakes.add(new Lake("Nepessing", 2.3, 35.0, Nepessing));
		lakes.add(new Lake("Hadley", 1.7, 24.0, Hadley));
		lakes.add(new Lake("Ortonville", 1.3, 15.0, Ortonville));
		lakes.add(new Lake("Fish", 1.1, 19.0, Fish));

		// Loop thru ArrayList and invoke all methods on lakes
		for (int i = 0; i < lakes.size(); i++) {
			// Get Lake from ArrayList; cast from Object to Lake
			Lake o = (Lake) lakes.get(i);
			System.out.println("\nLake: " + o.getName());
			System.out.println(" Area: " + o.getArea());
			System.out.println(" Depth: " + o.getDepth());

			// Get thermocline results and extract them from the ArrayList
			// that is the return value. 
			// Cast from Object to Double, then extract double from Double!
			ArrayList cline = o.getThermocline();
			double topZ = ((Double) cline.get(0)).doubleValue();
			double bottomZ = ((Double) cline.get(1)).doubleValue();
			double tempDiff = ((Double) cline.get(2)).doubleValue();
			System.out.println(" Thermocline top: " + topZ);
			System.out.println(" Thermocline bottom: " + bottomZ);
			System.out.println(" Thermocline temperature diff: " + tempDiff);
			
			// Get oxygen concentration results and extract them from array
			// that is the return value.
			double[] oxy= o.getAvgOxygen();
			System.out.println(" Avg oxygen top: " + oxy[0]);
			System.out.println(" Avg oxygen bottom: " + oxy[1]);

			boolean oxyOK= o.isOxyBelowOK();
			System.out.println(" Is oxygen below OK?: " + oxyOK);
		}
		
		// To invoke static methods, we must send in arguments for all the
		// data on which they operate. Invoke method on class name, not 
		// object name, for clarity.
		System.out.println("\nLake Nepessing temperatures");
		System.out.println(" Min temperature: " + Lake.getMinTemp(Nepessing));
		System.out.println(" Max temperature: " + Lake.getMaxTemp(Nepessing));
		
		System.out.println("\nLake Hadley temperatures");
		System.out.println(" Min temperature: " + Lake.getMinTemp(Hadley));
		System.out.println(" Max temperature: " + Lake.getMaxTemp(Hadley));
		
		System.out.println("\nLake Ortonville temperatures");
		System.out.println(" Min temperature: " + Lake.getMinTemp(Ortonville));
		System.out.println(" Max temperature: " + Lake.getMaxTemp(Ortonville));
		
		System.out.println("\nFish Lake temperatures");
		System.out.println(" Min temperature: " + Lake.getMinTemp(Fish));
		System.out.println(" Max temperature: " + Lake.getMaxTemp(Fish));
		
		System.out.println("\nNumber of lakes: "+ Lake.getNbrLakes());
	}
}
