package p07_funkcje;

public class JednostkiMiary {
	// napisz funkcje: mile_na_km , km_na_mile , far_na_cel , cel_na_far
	
	public static double mile_na_km(double mile) {
		return mile * 1.609344;
	}
	
	public static double km_na_mile(double km) {
		return km / 1.609344;
	}

	public static double far_na_cel(double far) {
		//źle return 5 / 9 * (far - 32);
		// return 5. / 9. * (far - 32);
		return (far - 32) / 1.8;
	}

	public static double cel_na_far(double cel) {
		// źle return 32 + 9 / 5 * cel;
		// return 32 + 9. / 5. * cel;
		return 32 + 1.8 * cel;
	}

	public static void main(String[] args) {
		System.out.println("testowe wywołania:");
		System.out.println("100 mil = " + JednostkiMiary.mile_na_km(100) + " km");
		System.out.println("500 mil = " + mile_na_km(500) + " km");
		System.out.println("100 km = " + km_na_mile(100) + " mil");
		System.out.println("160 km = " + km_na_mile(160) + " mil");
		System.out.println();

		System.out.println("0 °F = " + far_na_cel(0) + " °C");
		System.out.println("50 °F = " + far_na_cel(50) + " °C");
		System.out.println("100 °F = " + far_na_cel(100) + " °C");
		System.out.println();
		System.out.println("0 °C = " + cel_na_far(0) + " °F");
		System.out.println("37 °C = " + cel_na_far(37) + " °F");
		System.out.println("100 °C = " + cel_na_far(100) + " °F");
	}

}
