package run;

import enums.TempUnit;
import temp.*;

public class Runnable {

	public static void main(String[] args) {
		Temperature t1 = new Temperature(34, TempUnit.CELSIUS);
		System.out.println(t1);

		Temperature t2 = new Temperature(12, TempUnit.KELVIN);
		System.out.println(t2);
		
		Temperature[] tempArray = new Temperature[10];
		fillArray(tempArray);
		printArray(tempArray);
		
		double temp = t1.getTempInGivenUnit(TempUnit.CELSIUS);
		System.out.println("Temp: " + temp);
		
		double temp2 = Temperature.getTempInGivenUnit(t1, TempUnit.CELSIUS);
		System.out.println("Temp2: " + temp2);
	}

	
	private static void fillArray(Temperature[] inputArray) {
		for (int i = 0; i < inputArray.length; i++) {
			double value = Math.random()*100;
			inputArray[i] = new Temperature(value, TempUnit.CELSIUS);
		}
	}
	
	private static void printArray(Temperature[] inputArray) {
		for (Temperature temp : inputArray) {
			System.out.println(temp);
		}	
	}

	
	private static int maxTemp(Temperature[] inputArray) {
		int max = 0;
		
		for (int i=0;i<inputArray.length;i++) {
			if(inputArray[i].getTemp() > inputArray[max].getTemp()) {
				max = i;
			}
		}
		
		return max;
	}
}
