Commit 7358486a by Patryk Czarnik

importowanie - przygotowania

parent 1073a755
package p08_funkcje.przyklady;
public class Geometria {
// Aby nikomu nie przyszło do głowy tworzenie obiektu tej klasy,
// można ukryć konstruktor domyślny:
private Geometria() {
}
public static double poleKwadratu(double a) {
return a*a;
......
......@@ -64,25 +64,25 @@ public class GeometriaProgram {
System.out.printf("%.3f km = %.3f mil\n", km, wynik);
}
case "MK" -> {
System.out.print("Podaj odległość w milach: ");
double mile = scanner.nextDouble();
double wynik = JednostkiMiary.mile_na_km(mile);
System.out.printf("%.3f mil = %.3f km\n", mile, wynik);
System.out.print("Podaj odległość w milach: ");
double mile = scanner.nextDouble();
double wynik = JednostkiMiary.mile_na_km(mile);
System.out.printf("%.3f mil = %.3f km\n", mile, wynik);
}
case "FC" -> {
System.out.print("Podaj temperaturę w Fahrenheitach: ");
double f = scanner.nextDouble();
double wynik = JednostkiMiary.f_na_c(f);
System.out.printf("%.3f °F = %.3f °C\n", f, wynik);
System.out.print("Podaj temperaturę w Fahrenheitach: ");
double f = scanner.nextDouble();
double wynik = JednostkiMiary.f_na_c(f);
System.out.printf("%.3f °F = %.3f °C\n", f, wynik);
}
case "CF" -> {
System.out.print("Podaj temperaturę w Celsjuszach: ");
double c = scanner.nextDouble();
double wynik = JednostkiMiary.c_na_f(c);
System.out.printf("%.3f °C = %.3f °F\n", c, wynik);
System.out.print("Podaj temperaturę w Celsjuszach: ");
double c = scanner.nextDouble();
double wynik = JednostkiMiary.c_na_f(c);
System.out.printf("%.3f °C = %.3f °F\n", c, wynik);
}
default -> {
System.out.println("Nieznane polecenie " + wybor);
System.out.println("Nieznane polecenie " + wybor);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment