1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
|
public class Rechteck {
private int laenge;
private int breite;
public Rechteck (int x, int y) {
laenge = x;
breite = y;
}
public int getLaenge () {
return laenge;
}
public int getBreite () {
return breite;
}
public int getFlaeche (int laenge, int breite) {
int result = 0;
result = laenge * breite;
return result;
}
public boolean isQuadrat (int laenge, int breite) {
if (laenge == breite) {
return true;
}
else {
return false;
}
}
}
public class Kreis {
private int radius;
public Kreis (int x) {
radius = x;
}
public int getRadius () {
return radius;
}
public int getDurchmesser (int radius) {
int result = 0;
result = 2 * radius;
return result;
}
public boolean passtInRechteck (Rechteck rechteck) {
if ((2*radius) > rechteck.getLaenge() || (2*radius) > rechteck.getBreite()) {
return false;
}
else {
return true;
}
}
public static void main (String[]args) {
Rechteck rechteck1 = new Rechteck(3, 4);
Kreis kreis1 = new Kreis(5);
|