1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
|
public class FlacheKreis { //Klassennamen schreibt man groß
int radius;
double flache;
public static void main(String[] args) {
flacheKreis f = new flacheKreis();
f.menue();
f.berechneFlache();
}
public void menue() {
Scanner scan = new Scanner(System.in);
System.out.println("Geben Sie ein Radius :");
radius = scan.nextInt();
System.out.println("Der Radius ist :" + radius);
}
public void berechneFlache() {
flache = (double) (radius * radius * Math.PI);
System.out.println("Die Fläche beträgt: " + flache);
}
} |