first, and last commit
This commit is contained in:
commit
095004b5c4
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
Java 1.iml
|
125
src/de/joethei/java1/Zettel2.java
Normal file
125
src/de/joethei/java1/Zettel2.java
Normal file
@ -0,0 +1,125 @@
|
||||
package de.joethei.java1;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Zettel2 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
aufgabe1();
|
||||
aufgabe2();
|
||||
aufgabe3();
|
||||
aufgabe4();
|
||||
aufgabe5();
|
||||
aufgabe6a();
|
||||
aufgabe6b();
|
||||
aufgabe7();
|
||||
aufgabe8();
|
||||
}
|
||||
|
||||
private static void aufgabe1() {
|
||||
int i = 10;
|
||||
float f = 12.4F;
|
||||
String s = "Java macht Spaß";
|
||||
System.out.println(i + " " + f + " " + s);
|
||||
}
|
||||
|
||||
private static void aufgabe2() {
|
||||
int x = 5;
|
||||
x = x + 7;
|
||||
int y = x * 2;
|
||||
System.out.println(x + " " + y);
|
||||
}
|
||||
|
||||
private static void aufgabe3() {
|
||||
int x = 20;
|
||||
int y = 10;
|
||||
System.out.println((x >= y) ? x : y);
|
||||
}
|
||||
|
||||
private static void aufgabe4() {
|
||||
System.out.println("__________________\n" +
|
||||
"< Java is great! >\n" +
|
||||
" -----------------");
|
||||
System.out.println(" \\ ^__^");
|
||||
System.out.println(" \\ (oo)\\_______");
|
||||
System.out.println(" (__)\\ )\\/\\");
|
||||
System.out.println(" ||----w |");
|
||||
System.out.println(" || ||");
|
||||
}
|
||||
|
||||
private static void aufgabe5() {
|
||||
//int §kdl_ / 2 = 2;
|
||||
double €gd = 12;
|
||||
//boolean §§ = true;
|
||||
//boolean $hallo& = false;
|
||||
//float %flow = 3.0;
|
||||
//byte by @te = 2;
|
||||
byte Byte = 2;
|
||||
//float gehaltIn€ = 1798.32;
|
||||
}
|
||||
|
||||
private static void aufgabe6a() {
|
||||
int x = 18;
|
||||
int y = 10;
|
||||
int z = x;
|
||||
x = y;
|
||||
y = z;
|
||||
|
||||
System.out.println("x=" + x + " y=" + y);
|
||||
}
|
||||
|
||||
private static void aufgabe6b() {
|
||||
//Variante 1
|
||||
int x = 18;
|
||||
int y = 10;
|
||||
x = x ^ y ^ (y = x);
|
||||
System.out.println("x=" + x + " y=" + y);
|
||||
|
||||
//Variante 2
|
||||
x = 18;
|
||||
y = 10;
|
||||
x += (y - (y = x));
|
||||
System.out.println("x=" + x + " y=" + y);
|
||||
|
||||
//Variante 3
|
||||
x = 18;
|
||||
y = 10;
|
||||
x = x + y;
|
||||
y = x - y;
|
||||
x = x - y;
|
||||
System.out.println("x=" + x + " y=" + y);
|
||||
}
|
||||
|
||||
private static void aufgabe7() {
|
||||
int zahl1, zahl2;
|
||||
double ergebnisAddition, ergebnisSubstraktion, ergebnisMultiplikation, ergebnisDivision;
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Erste Zahl eingeben:");
|
||||
zahl1 = scanner.nextInt();
|
||||
System.out.println("Zweite Zahl eingeben:");
|
||||
zahl2 = scanner.nextInt();
|
||||
ergebnisAddition = zahl1 + zahl2;
|
||||
ergebnisSubstraktion = zahl1 - zahl2;
|
||||
ergebnisMultiplikation = zahl1 * zahl2;
|
||||
ergebnisDivision = zahl1 / zahl2;
|
||||
System.out.println("Addition: " + ergebnisAddition);
|
||||
System.out.println("Substraktion: " + ergebnisSubstraktion);
|
||||
System.out.println("Multiplikation: " + ergebnisMultiplikation);
|
||||
System.out.println("Division: " + ergebnisDivision);
|
||||
}
|
||||
|
||||
private static void aufgabe8() {
|
||||
int a = 5;
|
||||
int b = 7;
|
||||
int c;
|
||||
|
||||
c = b + a; //12
|
||||
b = b - 1; //6
|
||||
a = c; //12
|
||||
c = b + 6; //12
|
||||
b = a; //12
|
||||
//a = 12 b = 12 c = 12
|
||||
System.out.println("a=" + a + " b=" + b + " c=" + c);
|
||||
}
|
||||
|
||||
}
|
104
src/de/joethei/java1/Zettel3.java
Normal file
104
src/de/joethei/java1/Zettel3.java
Normal file
@ -0,0 +1,104 @@
|
||||
package de.joethei.java1;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Zettel3 {
|
||||
|
||||
private static Scanner scanner;
|
||||
|
||||
public static void main(String[] args) {
|
||||
scanner = new Scanner(System.in);
|
||||
aufgabe5a();
|
||||
aufgabe5b();
|
||||
aufgabe2();
|
||||
aufgabe3();
|
||||
aufgabe4();
|
||||
aufgabe5();
|
||||
}
|
||||
|
||||
//erster Zettel
|
||||
|
||||
private static void aufgabe5a() {
|
||||
System.out.println("Erste Zahl eingeben");
|
||||
int x = scanner.nextInt();
|
||||
System.out.println("Zweite Zahl eingeben");
|
||||
int y = scanner.nextInt();
|
||||
System.out.println("Die größere der beiden eingegebenen Zahlen ist: " + ((x > y) ? x : y));
|
||||
}
|
||||
|
||||
private static void aufgabe5b() {
|
||||
System.out.println("Bitte eine Zahl eingeben");
|
||||
int input = scanner.nextInt();
|
||||
if((input / 100) > 0) {
|
||||
System.out.println((input / 100) + " m " + (input % 100) + " cm");
|
||||
}else {
|
||||
System.out.println(input + " cm");
|
||||
}
|
||||
}
|
||||
|
||||
//Zweiter Zettel
|
||||
|
||||
private static void aufgabe2() {
|
||||
int i = 10;
|
||||
while (i >= 0) {
|
||||
if (i == 0) System.out.print("Zero\n");
|
||||
else System.out.print(i + " ");
|
||||
i--;
|
||||
}
|
||||
for (int j = 10; j >= 0; j--) {
|
||||
if (j == 0) System.out.print("Zero\n");
|
||||
else System.out.print(j + " ");
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe3() {
|
||||
double i = 1000.00;
|
||||
int j = 0;
|
||||
while (i <= 10000.00) {
|
||||
i = i * 1.045;
|
||||
j++;
|
||||
}
|
||||
System.out.println("Es werden " + j + " Jahre benötigt um den Endbetrag zu erreichen");
|
||||
}
|
||||
|
||||
private static void aufgabe4() {
|
||||
System.out.println("Bitte geben Sie eine Ganzahl an");
|
||||
int input = scanner.nextInt();
|
||||
int i = 1;
|
||||
long result = 1;
|
||||
while (i != input) {
|
||||
i++;
|
||||
result = result * i;
|
||||
}
|
||||
System.out.println("Die Fakultät von " + input + " ist " + result);
|
||||
}
|
||||
|
||||
private static void aufgabe5() {
|
||||
int spaces = 0;
|
||||
for (int i = 16; i >= 2; i--) {
|
||||
spaces++;
|
||||
for (int j = 0; j <= spaces; j++) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
i--;
|
||||
for (int j = 0; j <= i; j++) {
|
||||
//if (j % 3 == 0) System.out.print("o");
|
||||
System.out.print("+");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
for (int i = 0; i <= 8; i++) {
|
||||
for (int j = 0; j <= spaces; j++) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.print("++\n");
|
||||
}
|
||||
for (int i = 0; i <= 4; i++) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
for (int i = 0; i <= 9; i++) {
|
||||
System.out.print("+");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
263
src/de/joethei/java1/Zettel4.java
Normal file
263
src/de/joethei/java1/Zettel4.java
Normal file
@ -0,0 +1,263 @@
|
||||
package de.joethei.java1;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Zettel4 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
aufgabe1a();
|
||||
aufgabe1b();
|
||||
aufgabe2();
|
||||
aufgabe3();
|
||||
aufgabe4();
|
||||
aufgabe5();
|
||||
aufgabe6();
|
||||
aufgabe7a();
|
||||
aufgabe7b();
|
||||
aufgabe7c();
|
||||
aufgabe7d();
|
||||
aufgabe8a();
|
||||
aufgabe8b();
|
||||
aufgabe8c();
|
||||
aufgabe8d();
|
||||
aufgabe8e();
|
||||
aufgabe8f();
|
||||
}
|
||||
|
||||
private static void aufgabe1a() {
|
||||
for(int i = 1; i <= 10; i++) {
|
||||
System.out.println(i + " x " + i + " x " + i + " = " + i*i*i);
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe1b() {
|
||||
for(int i = 1; i <= 7; i++) {
|
||||
System.out.println(i + " x " + (i + 1) + " x " + (i + 2) + " = " + i*(i + 1)*(i + 2));
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe2() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Startkapital eingeben");
|
||||
double start = scanner.nextLong();
|
||||
System.out.println("Zinssatz angeben");
|
||||
double zins = scanner.nextDouble();
|
||||
double end10 = start * Math.pow((1 + zins / 100), 10);
|
||||
System.out.println("In 10 Jahren ist das Kapital: " + end10);
|
||||
|
||||
double end = start;
|
||||
int i = 0;
|
||||
while (end <= start * 2) {
|
||||
i++;
|
||||
end = start * Math.pow((1 + zins / 100), i);
|
||||
}
|
||||
System.out.println("Das Kapital wird in " + i + " Jahren verdoppelt sein.");
|
||||
System.out.println("Das Kapital wird " + end + " betragen");
|
||||
}
|
||||
|
||||
private static void aufgabe3() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Name:");
|
||||
String name = scanner.next();
|
||||
System.out.println("Alter:");
|
||||
int age = scanner.nextInt();
|
||||
System.out.println("Geschlecht (m/w):");
|
||||
String gender = scanner.next();
|
||||
int greetings = age/4;
|
||||
String greeting;
|
||||
if(age < 18) greeting = "Hallo ";
|
||||
else if(gender.equalsIgnoreCase("w")) greeting = "Guten Tag Frau ";
|
||||
else if(gender.equalsIgnoreCase("m")) greeting = "Guten Tag Herr ";
|
||||
else greeting = "Nicht definiert";
|
||||
if(greetings <= 3) greetings = 3;
|
||||
for(int i = greetings; i >= 1; i--) {
|
||||
System.out.println(greeting + name + "!");
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe4() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Höhe angeben");
|
||||
int height = scanner.nextInt();
|
||||
int spaces = height * 2;
|
||||
int bottom = spaces;
|
||||
for(int i = 0; i <= height-1; i++) {
|
||||
spaces--;
|
||||
for (int j = 0; j <= spaces; j++) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
for (int j = 0; j <= i; j++) {
|
||||
System.out.print("* ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
for (int i = 0; i < 2 ; i++) {
|
||||
for (int j = 0; j <= bottom-1; j++) {
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.println("*");
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe5() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
int number = new Random().nextInt(100);
|
||||
System.out.println("Raten Sie die Zahl");
|
||||
//System.out.println("Die Zahl ist " + number);
|
||||
int tries = 1;
|
||||
while (scanner.nextInt() != number) {
|
||||
tries++;
|
||||
}
|
||||
switch (tries) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
System.out.println("Einfach toll gemacht. Nahezu genial");
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
System.out.println("Gut gemacht Sie sind fast wie Einstein.");
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
System.out.println("Wahr wohl doch nicht so leicht...");
|
||||
break;
|
||||
default:
|
||||
System.out.println("Üben üben üben... Es wird schon!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe6() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Was soll berechnet werden (Kreis, Quadrat, Dreieck) ?");
|
||||
String type = scanner.next();
|
||||
if(type.equalsIgnoreCase("kreis")) {
|
||||
System.out.println("Durchmesser des Kreises angeben:");
|
||||
System.out.println("Die Fläche des Kreises beträgt: " + ((Math.pow(scanner.nextInt(), 2) * Math.PI) / 4));
|
||||
}
|
||||
if(type.equalsIgnoreCase("quadrat")) {
|
||||
System.out.println("Länge einer Seite angeben:");
|
||||
System.out.println("Die Fläche des Quadrats beträgt: " + Math.pow(scanner.nextInt(), 2));
|
||||
}
|
||||
if(type.equalsIgnoreCase("dreieck")) {
|
||||
System.out.println("Länge der Seite a angeben:");
|
||||
int a = scanner.nextInt();
|
||||
System.out.println("Höhe angeben:");
|
||||
System.out.println("Die Fläche des Kreises beträgt: " + (a * scanner.nextInt()) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe7a() {
|
||||
for(int i = 1; i <= 50; i++) {
|
||||
System.out.print(i + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private static void aufgabe7b() {
|
||||
for(int i = 1; i <= 99; i+=2) {
|
||||
System.out.print(i + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private static void aufgabe7c() {
|
||||
int j;
|
||||
int m = 0;
|
||||
int n = 1;
|
||||
for(int i = 1; i <= 10; i++) {
|
||||
j = m + n;
|
||||
m = n;
|
||||
n = j;
|
||||
System.out.print(j + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private static void aufgabe7d() {
|
||||
int j = 0;
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
if((i % 2) == 0) j = j + 3;
|
||||
else j = j+1;
|
||||
System.out.print(j + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private static void aufgabe8a() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 15; j++) {
|
||||
System.out.print("+");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe8b() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 15; j++) {
|
||||
if((i % 2) == 0) System.out.print("+");
|
||||
else System.out.print("-");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe8c() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
if((j <= 7 && i <= 3) || j >= 8 && i >=4) System.out.print(".");
|
||||
else System.out.print("+");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe8d() {
|
||||
int points = 14;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < points; j++) {
|
||||
System.out.print(".");
|
||||
}
|
||||
for (int j = 0; j < (14 - points); j++) {
|
||||
System.out.print("+");
|
||||
}
|
||||
System.out.println();
|
||||
points -=2;
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe8e() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 0; j < 9-i; j++) {
|
||||
System.out.print(".");
|
||||
}
|
||||
for (int j = 0; j < i*2+1; j++) {
|
||||
System.out.print("+");
|
||||
}
|
||||
for (int j = 0; j < 9-i; j++) {
|
||||
System.out.print(".");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe8f() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 0; j < 9-i; j++) {
|
||||
System.out.print(".");
|
||||
}
|
||||
for (int j = 0; j < i*2+1; j++) {
|
||||
if((j % 2) == 0) System.out.print("+");
|
||||
else System.out.print("O");
|
||||
}
|
||||
for (int j = 0; j < 9-i; j++) {
|
||||
System.out.print(".");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
189
src/de/joethei/java1/Zettel5.java
Normal file
189
src/de/joethei/java1/Zettel5.java
Normal file
@ -0,0 +1,189 @@
|
||||
package de.joethei.java1;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Zettel5 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
aufgabe1();
|
||||
aufgabe2();
|
||||
aufgabe3a();
|
||||
aufgabe3b();
|
||||
aufgabe4a();
|
||||
aufgabe4b();
|
||||
aufgabe4c();
|
||||
aufgabe5();
|
||||
aufgabe6();
|
||||
}
|
||||
|
||||
private static void aufgabe1() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Geben sie eine ganze positive Zahl ein");
|
||||
int number = scanner.nextInt();
|
||||
do{
|
||||
switch (number % 10) {
|
||||
case 0:
|
||||
System.out.print("null");
|
||||
break;
|
||||
case 1:
|
||||
System.out.print("eins");
|
||||
break;
|
||||
case 2:
|
||||
System.out.print("zwei");
|
||||
break;
|
||||
case 3:
|
||||
System.out.print("drei");
|
||||
break;
|
||||
case 4:
|
||||
System.out.print("vier");
|
||||
break;
|
||||
case 5:
|
||||
System.out.print("fünf");
|
||||
break;
|
||||
case 6:
|
||||
System.out.print("sechs");
|
||||
break;
|
||||
case 7:
|
||||
System.out.print("sieben");
|
||||
break;
|
||||
case 8:
|
||||
System.out.print("acht");
|
||||
break;
|
||||
case 9:
|
||||
System.out.print("neun");
|
||||
break;
|
||||
}
|
||||
System.out.print(" ");
|
||||
number /= 10;
|
||||
} while (number > 0);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
private static void aufgabe2() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Geben Sie die Länge der alternierenden harmonischen Reihe an");
|
||||
System.out.println(aufgabe2(scanner.nextInt()));
|
||||
}
|
||||
|
||||
private static double aufgabe2(int n) {
|
||||
if(n == 1) return 1.0;
|
||||
else if((n % 2) == 0) {
|
||||
return aufgabe2(n-1) - (1.0/n);
|
||||
}else {
|
||||
return aufgabe2(n-1) + (1.0/n);
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe3a() {
|
||||
int[] array = new int[10];
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
array[random.nextInt(10)] +=1;
|
||||
}
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
System.out.println(i + "=" + array[i-1]);
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe3b() {
|
||||
int[] array = new int[10];
|
||||
Random random = new Random();
|
||||
int i = 0;
|
||||
while (i < 1000) {
|
||||
array[random.nextInt(10)] +=1;
|
||||
i++;
|
||||
}
|
||||
int j = 1;
|
||||
while (j <= 10) {
|
||||
System.out.println(j + "=" + array[j-1]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe4a() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Wie lang soll das Feld werden ?");
|
||||
int[] array = new int[scanner.nextInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
System.out.println((i + 1) + ". Feld angeben");
|
||||
array[i] = scanner.nextInt();
|
||||
}
|
||||
int min = Integer.MAX_VALUE;
|
||||
for (int i : array) {
|
||||
min = Math.min(min, i);
|
||||
}
|
||||
System.out.println("Die kleinste Element ist " + min);
|
||||
}
|
||||
|
||||
private static void aufgabe4b() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Wie lang soll das Feld werden ?");
|
||||
int[] array = new int[scanner.nextInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
System.out.println((i + 1) + ". Feld angeben");
|
||||
array[i] = scanner.nextInt();
|
||||
}
|
||||
int max = 0;
|
||||
for (int i : array) {
|
||||
max = Math.max(max, i);
|
||||
}
|
||||
System.out.println("Die größte Element ist " + max);
|
||||
}
|
||||
|
||||
private static void aufgabe4c() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Wie lang soll das Feld werden ?");
|
||||
int[] array = new int[scanner.nextInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
System.out.println((i + 1) + ". Feld angeben");
|
||||
array[i] = scanner.nextInt();
|
||||
}
|
||||
|
||||
int sum = 0;
|
||||
for (int i : array) {
|
||||
sum += i;
|
||||
}
|
||||
System.out.println("Der Durchschnitt der angegeben Zahlen ist " + (sum / array.length));
|
||||
}
|
||||
|
||||
private static void aufgabe5() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Wie viele Elemente soll das Feld haben ?");
|
||||
int[] array = new int[scanner.nextInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
System.out.println((i + 1) + ". Feld angeben");
|
||||
array[i] = scanner.nextInt();
|
||||
}
|
||||
for (int i = 1; i < array.length; i++) {
|
||||
if((i % 2) == 0) {
|
||||
int temp = array[i];
|
||||
array[i] = array[i-1];
|
||||
array[i-1] = temp;
|
||||
}
|
||||
}
|
||||
for (int i : array) {
|
||||
System.out.print(i + " ");
|
||||
}
|
||||
}
|
||||
|
||||
private static void aufgabe6() {
|
||||
int[] array = new int[]{2, 17, 3, -1, 5, 0, 0, 23};
|
||||
int left = 0;
|
||||
int min;
|
||||
do {
|
||||
min = left;
|
||||
for (int i = left+1; i < array.length; i++) {
|
||||
if(array[i] < array[min]) min = i;
|
||||
}
|
||||
int temp = array[min];
|
||||
array[min] = array[left];
|
||||
array[left] = temp;
|
||||
left +=1;
|
||||
|
||||
}while (left < array.length);
|
||||
for(int i : array) {
|
||||
System.out.print(i + " ");
|
||||
}
|
||||
}
|
||||
}
|
25
src/de/joethei/java1/zettel6/Kalender.java
Normal file
25
src/de/joethei/java1/zettel6/Kalender.java
Normal file
@ -0,0 +1,25 @@
|
||||
package de.joethei.java1.zettel6;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Kalender {
|
||||
|
||||
private ArrayList<Termin> termine;
|
||||
|
||||
public Kalender() {
|
||||
termine = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean add(Termin termin) {
|
||||
return termine.add(termin);
|
||||
}
|
||||
|
||||
public void termineAuflisten() {
|
||||
if(termine.isEmpty()) System.out.println("Es sind keine Termine hinterlegt");
|
||||
else termine.forEach(termin -> System.out.println(termin.toString()));
|
||||
}
|
||||
|
||||
public boolean suche(Termin termin) {
|
||||
return termine.contains(termin);
|
||||
}
|
||||
}
|
65
src/de/joethei/java1/zettel6/Main.java
Normal file
65
src/de/joethei/java1/zettel6/Main.java
Normal file
@ -0,0 +1,65 @@
|
||||
package de.joethei.java1.zettel6;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//2
|
||||
//testen auf Funktionalität
|
||||
Kalender kalender = new Kalender();
|
||||
Termin termin = new Termin(new Date(), "hier", "dafür", 10);
|
||||
kalender.add(termin);
|
||||
kalender.add(new Termin(new Date(), "da", "hierfür", 5));
|
||||
kalender.termineAuflisten();
|
||||
System.out.println(kalender.suche(termin));
|
||||
|
||||
//4
|
||||
Professor professor = new Professor("Mustermann");
|
||||
|
||||
professor.addVorlesung(new Vorlesung2("Muster 1", 25));
|
||||
professor.addVorlesung(new Vorlesung2("Muster 2", 10));
|
||||
|
||||
System.out.println(professor.gesamtSWS());
|
||||
|
||||
//5
|
||||
String hallo = "Hallo";
|
||||
String underscore = "_";
|
||||
String welt = "Welt";
|
||||
System.out.println(schmeltze(hallo, underscore, welt));
|
||||
System.out.println(reverse(hallo));
|
||||
zeichenWeiseAusgeben(welt);
|
||||
System.out.println(vermischeBuchstabenInWort(hallo));
|
||||
}
|
||||
|
||||
public static String schmeltze(String a, String b, String c) {
|
||||
return a + b + c;
|
||||
}
|
||||
|
||||
public static String reverse(String s) {
|
||||
return new StringBuilder(s).reverse().toString();
|
||||
}
|
||||
|
||||
public static void zeichenWeiseAusgeben(String s) {
|
||||
for(char c : s.toCharArray()) {
|
||||
System.out.println(c);
|
||||
}
|
||||
}
|
||||
|
||||
public static String vermischeBuchstabenInWort(String s) {
|
||||
char[] array = s.toCharArray();
|
||||
char[] result = new char[s.length()];
|
||||
Random random = new Random();
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
int r = random.nextInt(array.length);
|
||||
char tmp = array[i];
|
||||
result[i] = array[r];
|
||||
result[r] = tmp;
|
||||
}
|
||||
|
||||
return String.valueOf(result);
|
||||
}
|
||||
}
|
34
src/de/joethei/java1/zettel6/Professor.java
Normal file
34
src/de/joethei/java1/zettel6/Professor.java
Normal file
@ -0,0 +1,34 @@
|
||||
package de.joethei.java1.zettel6;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Professor {
|
||||
|
||||
private ArrayList<Vorlesung2> vorlesungen = new ArrayList<>();
|
||||
|
||||
private String name;
|
||||
|
||||
public Professor(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean addVorlesung(Vorlesung2 vorlesung2) {
|
||||
return vorlesungen.add(vorlesung2);
|
||||
}
|
||||
|
||||
public ArrayList<Vorlesung2> getVorlesungen() {
|
||||
return vorlesungen;
|
||||
}
|
||||
|
||||
public int gesamtSWS() {
|
||||
return vorlesungen.stream().mapToInt(Vorlesung2::getSws).sum();
|
||||
}
|
||||
}
|
55
src/de/joethei/java1/zettel6/Termin.java
Normal file
55
src/de/joethei/java1/zettel6/Termin.java
Normal file
@ -0,0 +1,55 @@
|
||||
package de.joethei.java1.zettel6;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Termin {
|
||||
|
||||
private Date zeit;
|
||||
private String ort;
|
||||
private String zweck;
|
||||
private int dringlichkeit;
|
||||
|
||||
public Termin(Date zeit, String ort, String zweck, int dringlichkeit) {
|
||||
this.zeit = zeit;
|
||||
this.ort = ort;
|
||||
this.zweck = zweck;
|
||||
this.dringlichkeit = dringlichkeit;
|
||||
}
|
||||
|
||||
public Date getZeit() {
|
||||
return zeit;
|
||||
}
|
||||
|
||||
public void setZeit(Date zeit) {
|
||||
this.zeit = zeit;
|
||||
}
|
||||
|
||||
public String getOrt() {
|
||||
return ort;
|
||||
}
|
||||
|
||||
public void setOrt(String ort) {
|
||||
this.ort = ort;
|
||||
}
|
||||
|
||||
public String getZweck() {
|
||||
return zweck;
|
||||
}
|
||||
|
||||
public void setZweck(String zweck) {
|
||||
this.zweck = zweck;
|
||||
}
|
||||
|
||||
public int getDringlichkeit() {
|
||||
return dringlichkeit;
|
||||
}
|
||||
|
||||
public void setDringlichkeit(int dringlichkeit) {
|
||||
this.dringlichkeit = dringlichkeit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Zeit: " + zeit.toString() + " Ort: " + ort + " Zweck: " + zweck + " Dringlichkeit: " + dringlichkeit;
|
||||
}
|
||||
}
|
28
src/de/joethei/java1/zettel6/Vorlesung1.java
Normal file
28
src/de/joethei/java1/zettel6/Vorlesung1.java
Normal file
@ -0,0 +1,28 @@
|
||||
package de.joethei.java1.zettel6;
|
||||
|
||||
public class Vorlesung1 {
|
||||
|
||||
private String titel;
|
||||
private int sws;
|
||||
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
public void setTitel(String titel) {
|
||||
this.titel = titel;
|
||||
}
|
||||
|
||||
public int getSws() {
|
||||
return sws;
|
||||
}
|
||||
|
||||
public void setSws(int sws) {
|
||||
this.sws = sws;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Titel: " + titel + " SWS: " + sws;
|
||||
}
|
||||
}
|
33
src/de/joethei/java1/zettel6/Vorlesung2.java
Normal file
33
src/de/joethei/java1/zettel6/Vorlesung2.java
Normal file
@ -0,0 +1,33 @@
|
||||
package de.joethei.java1.zettel6;
|
||||
|
||||
public class Vorlesung2 {
|
||||
|
||||
private String titel;
|
||||
private int sws;
|
||||
|
||||
public Vorlesung2(String titel, int sws) {
|
||||
this.titel = titel;
|
||||
this.sws = sws;
|
||||
}
|
||||
|
||||
public String getTitel() {
|
||||
return titel;
|
||||
}
|
||||
|
||||
public void setTitel(String titel) {
|
||||
this.titel = titel;
|
||||
}
|
||||
|
||||
public int getSws() {
|
||||
return sws;
|
||||
}
|
||||
|
||||
public void setSws(int sws) {
|
||||
this.sws = sws;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Titel: " + titel + " SWS: " + sws;
|
||||
}
|
||||
}
|
30
src/de/joethei/java1/zettel7/Angebot.java
Normal file
30
src/de/joethei/java1/zettel7/Angebot.java
Normal file
@ -0,0 +1,30 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
public class Angebot {
|
||||
|
||||
private int basispreis;
|
||||
private int freiMinuten;
|
||||
private double minutenPreis;
|
||||
|
||||
public Angebot(int basispreis, int freiMinuten, double minutenPreis) {
|
||||
this.basispreis = basispreis;
|
||||
this.freiMinuten = freiMinuten;
|
||||
this.minutenPreis = minutenPreis;
|
||||
}
|
||||
|
||||
public int getBasispreis() {
|
||||
return basispreis;
|
||||
}
|
||||
|
||||
public int getFreiMinuten() {
|
||||
return freiMinuten;
|
||||
}
|
||||
|
||||
public double getMinutenPreis() {
|
||||
return minutenPreis;
|
||||
}
|
||||
|
||||
public double berechnePreis(int minuten) {
|
||||
return basispreis + (minuten - freiMinuten) * minutenPreis;
|
||||
}
|
||||
}
|
57
src/de/joethei/java1/zettel7/Bruch.java
Normal file
57
src/de/joethei/java1/zettel7/Bruch.java
Normal file
@ -0,0 +1,57 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
public class Bruch {
|
||||
|
||||
private int zaehler;
|
||||
private int nenner;
|
||||
|
||||
public Bruch(int zaehler, int nenner) {
|
||||
this.zaehler = zaehler;
|
||||
this.nenner = nenner;
|
||||
}
|
||||
|
||||
public Bruch addition(Bruch bruch) {
|
||||
int nenner = this.nenner * bruch.nenner;
|
||||
int zaehler1 = this.zaehler * bruch.nenner;
|
||||
int zaehler2 = bruch.zaehler * this.nenner;
|
||||
return new Bruch(zaehler1 + zaehler2, nenner);
|
||||
}
|
||||
|
||||
public Bruch substraktion(Bruch bruch) {
|
||||
int nenner = this.nenner * bruch.nenner;
|
||||
int zaehler1 = this.zaehler * bruch.nenner;
|
||||
int zaehler2 = bruch.zaehler * this.nenner;
|
||||
return new Bruch(zaehler1 - zaehler2, nenner);
|
||||
}
|
||||
|
||||
public Bruch multiplikation(Bruch bruch) {
|
||||
return new Bruch(this.zaehler * bruch.zaehler, this.nenner * bruch.nenner);
|
||||
}
|
||||
|
||||
public Bruch division(Bruch bruch) {
|
||||
return this.multiplikation(new Bruch(bruch.nenner, bruch.zaehler));
|
||||
}
|
||||
|
||||
public double toDouble() {
|
||||
return (double) this.zaehler / this.nenner;
|
||||
}
|
||||
|
||||
public static Bruch addition(Bruch bruch, Bruch bruch1) {
|
||||
int nenner = bruch1.nenner * bruch.nenner;
|
||||
int zaehler1 = bruch1.zaehler * bruch.nenner;
|
||||
int zaehler2 = bruch.zaehler * bruch1.nenner;
|
||||
return new Bruch(zaehler1 + zaehler2, nenner);
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Bruch bruch) {
|
||||
int zaehler1 = this.zaehler * bruch.nenner;
|
||||
int zaehler2 = bruch.zaehler * this.nenner;
|
||||
return zaehler1 == zaehler2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.zaehler + "/" + this.nenner;
|
||||
}
|
||||
}
|
34
src/de/joethei/java1/zettel7/Bus.java
Normal file
34
src/de/joethei/java1/zettel7/Bus.java
Normal file
@ -0,0 +1,34 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
public class Bus extends Fahrzeug {
|
||||
private int sitzplaetze;
|
||||
|
||||
public Bus(String kennzeichen, int sitzplaetze) {
|
||||
super.setKennzeichen(kennzeichen);
|
||||
this.sitzplaetze = sitzplaetze;
|
||||
}
|
||||
|
||||
public int getSitzplaetze() {
|
||||
return sitzplaetze;
|
||||
}
|
||||
|
||||
public void setSitzplaetze(int sitzplaetze) {
|
||||
this.sitzplaetze = sitzplaetze;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double berechneSteuer() {
|
||||
return 800 + (sitzplaetze * 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ": Bus mit " + sitzplaetze + " Sitzplätzen. " + berechneSteuer() + "€ Steuern müssen bezahlt werden.";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o) && o instanceof Bus && (getSitzplaetze() == ((Bus)o).getSitzplaetze());
|
||||
}
|
||||
}
|
28
src/de/joethei/java1/zettel7/Fahrzeug.java
Normal file
28
src/de/joethei/java1/zettel7/Fahrzeug.java
Normal file
@ -0,0 +1,28 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
public class Fahrzeug {
|
||||
|
||||
private String kennzeichen;
|
||||
|
||||
public String getKennzeichen() {
|
||||
return kennzeichen;
|
||||
}
|
||||
|
||||
public void setKennzeichen(String kennzeichen) {
|
||||
this.kennzeichen = kennzeichen;
|
||||
}
|
||||
|
||||
public double berechneSteuer() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Fahrzeug && ((Fahrzeug)o).getKennzeichen().equals(getKennzeichen());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getKennzeichen();
|
||||
}
|
||||
}
|
35
src/de/joethei/java1/zettel7/Fuhrpark.java
Normal file
35
src/de/joethei/java1/zettel7/Fuhrpark.java
Normal file
@ -0,0 +1,35 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Fuhrpark {
|
||||
|
||||
private ArrayList<Fahrzeug> fahrzeuge = new ArrayList<>();
|
||||
|
||||
public boolean addFahrzeug(Fahrzeug fahzeug) {
|
||||
return fahrzeuge.add(fahzeug);
|
||||
}
|
||||
|
||||
public ArrayList<Fahrzeug> getFahrzeuge() {
|
||||
return fahrzeuge;
|
||||
}
|
||||
|
||||
public double berechneSteuer() {
|
||||
double tmp = 0.D;
|
||||
for(Fahrzeug fahrzeug : fahrzeuge) {
|
||||
tmp += fahrzeug.berechneSteuer();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder tmp = new StringBuilder();
|
||||
tmp.append(berechneSteuer()).append("\n");
|
||||
for(Fahrzeug fahrzeug : fahrzeuge) {
|
||||
tmp.append(fahrzeug.toString());
|
||||
tmp.append("\n");
|
||||
}
|
||||
return tmp.toString();
|
||||
}
|
||||
}
|
38
src/de/joethei/java1/zettel7/LKW.java
Normal file
38
src/de/joethei/java1/zettel7/LKW.java
Normal file
@ -0,0 +1,38 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
public class LKW extends Fahrzeug {
|
||||
private double nutzlast;
|
||||
|
||||
public LKW(String kennzeichen, double nutzlast) {
|
||||
super.setKennzeichen(kennzeichen);
|
||||
this.nutzlast = nutzlast;
|
||||
}
|
||||
|
||||
public LKW(LKW lkw) {
|
||||
super.setKennzeichen(lkw.getKennzeichen());
|
||||
this.nutzlast = lkw.getNutzlast();
|
||||
}
|
||||
|
||||
public double getNutzlast() {
|
||||
return nutzlast;
|
||||
}
|
||||
|
||||
public void setNutzlast(double nutzlast) {
|
||||
this.nutzlast = nutzlast;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double berechneSteuer() {
|
||||
return 500 + (nutzlast * 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ": LKW mit " + nutzlast + " Tonnen Nutzlast. " + berechneSteuer() + "€ Steuern müssen bezahlt werden.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return super.equals(o) && o instanceof LKW && (getNutzlast() == ((LKW)o).getNutzlast());
|
||||
}
|
||||
}
|
47
src/de/joethei/java1/zettel7/Main.java
Normal file
47
src/de/joethei/java1/zettel7/Main.java
Normal file
@ -0,0 +1,47 @@
|
||||
package de.joethei.java1.zettel7;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main{
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Bruch bruch = new Bruch(1, 2);
|
||||
|
||||
System.out.println(bruch.addition(new Bruch(1, 2)).toString());
|
||||
System.out.println(bruch.substraktion(new Bruch(1, 2)).toString());
|
||||
System.out.println(bruch.multiplikation(new Bruch(1, 2)).toString());
|
||||
System.out.println(bruch.division(new Bruch(1, 2)).toString());
|
||||
|
||||
System.out.println(bruch.equals(new Bruch(5, 10)));
|
||||
System.out.println(bruch.equals(new Bruch(5, 6)));
|
||||
|
||||
ArrayList<Angebot> angebote = new ArrayList<>();
|
||||
angebote.add(new Angebot(27, 45, 0.14));
|
||||
angebote.add(new Angebot(30, 50, 0.13));
|
||||
angebote.add(new Angebot(5, 0, 0.3));
|
||||
angebote.add(new Angebot(10, 20, 0.08));
|
||||
|
||||
System.out.println("Gesprächsminuten eingeben");
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
int minuten = scanner.nextInt();
|
||||
|
||||
Angebot tmp = angebote.get(0);
|
||||
for(Angebot angebot : angebote) {
|
||||
if (angebot.berechnePreis(minuten) <= tmp.berechnePreis(minuten)) tmp = angebot;
|
||||
}
|
||||
System.out.println("Der Vertrag mit dem Baisispreis " + tmp.getBasispreis() + " ist am günstigsten");
|
||||
|
||||
Fuhrpark fuhrpark = new Fuhrpark();
|
||||
fuhrpark.addFahrzeug(new Bus("EMD ER 124", 10));
|
||||
fuhrpark.addFahrzeug(new LKW("EMD ER 123", 5.3));
|
||||
|
||||
for(Fahrzeug fahrzeug : fuhrpark.getFahrzeuge()) {
|
||||
fahrzeug.berechneSteuer();
|
||||
}
|
||||
|
||||
System.out.println(fuhrpark.toString());
|
||||
|
||||
}
|
||||
}
|
122
src/de/joethei/java1/zettel7/zettel7.uml
Normal file
122
src/de/joethei/java1/zettel7/zettel7.uml
Normal file
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Diagram>
|
||||
<ID>JAVA</ID>
|
||||
<OriginalElement>de.joethei.java1.zettel7</OriginalElement>
|
||||
<nodes>
|
||||
<node x="58.0" y="425.0">de.joethei.java1.zettel7.Bruch</node>
|
||||
<node x="395.42045454545456" y="237.0">de.joethei.java1.zettel7.Fahrzeug</node>
|
||||
<node x="494.875" y="12.0">de.joethei.java1.zettel7.Bus</node>
|
||||
<node x="331.0844155844156" y="812.0">de.joethei.java1.zettel7.Main</node>
|
||||
<node x="339.69237012987014" y="509.5">de.joethei.java1.zettel7.Fuhrpark</node>
|
||||
<node x="237.875" y="0.0">de.joethei.java1.zettel7.LKW</node>
|
||||
</nodes>
|
||||
<notes />
|
||||
<edges>
|
||||
<edge source="de.joethei.java1.zettel7.Main" target="de.joethei.java1.zettel7.Fahrzeug">
|
||||
<point x="51.428571428571445" y="-27.5" />
|
||||
<point x="472.512987012987" y="782.0" />
|
||||
<point x="616.3798701298701" y="782.0" />
|
||||
<point x="616.3798701298701" y="405.0" />
|
||||
<point x="585.2954545454545" y="405.0" />
|
||||
<point x="81.375" y="64.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.LKW" target="de.joethei.java1.zettel7.Fahrzeug">
|
||||
<point x="81.375" y="88.5" />
|
||||
<point x="427.75" y="217.0" />
|
||||
<point x="476.79545454545456" y="217.0" />
|
||||
<point x="-27.125" y="-64.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Main" target="de.joethei.java1.zettel7.LKW">
|
||||
<point x="-25.714285714285666" y="-27.5" />
|
||||
<point x="395.3701298701299" y="772.0" />
|
||||
<point x="309.5" y="772.0" />
|
||||
<point x="309.5" y="217.0" />
|
||||
<point x="319.25" y="217.0" />
|
||||
<point x="-27.125" y="88.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Main" target="de.joethei.java1.zettel7.Fuhrpark">
|
||||
<point x="0.0" y="-27.5" />
|
||||
<point x="421.0844155844156" y="792.0" />
|
||||
<point x="405.69237012987014" y="792.0" />
|
||||
<point x="-66.0" y="64.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Bruch" target="de.joethei.java1.zettel7.Bruch">
|
||||
<point x="-90.375" y="148.5" />
|
||||
<point x="88.125" y="742.0" />
|
||||
<point x="38.0" y="742.0" />
|
||||
<point x="38.0" y="647.75" />
|
||||
<point x="-120.5" y="74.25" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Main" target="de.joethei.java1.zettel7.Bus">
|
||||
<point x="77.14285714285711" y="-27.5" />
|
||||
<point x="498.2272727272727" y="792.0" />
|
||||
<point x="662.4642857142858" y="792.0" />
|
||||
<point x="662.4642857142858" y="217.0" />
|
||||
<point x="684.75" y="217.0" />
|
||||
<point x="81.375" y="76.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Main" target="de.joethei.java1.zettel7.Bruch">
|
||||
<point x="-77.14285714285711" y="-27.5" />
|
||||
<point x="343.94155844155847" y="792.0" />
|
||||
<point x="208.625" y="792.0" />
|
||||
<point x="30.125" y="148.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Fahrzeug" target="de.joethei.java1.zettel7.LKW">
|
||||
<point x="-81.375" y="-64.0" />
|
||||
<point x="422.54545454545456" y="217.0" />
|
||||
<point x="373.5" y="217.0" />
|
||||
<point x="27.125" y="88.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Fuhrpark" target="de.joethei.java1.zettel7.Fahrzeug">
|
||||
<point x="-65.99999999999994" y="-64.0" />
|
||||
<point x="405.69237012987014" y="405.0" />
|
||||
<point x="476.79545454545456" y="405.0" />
|
||||
<point x="-27.125" y="64.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Bus" target="de.joethei.java1.zettel7.Bus">
|
||||
<point x="-81.375" y="76.5" />
|
||||
<point x="522.0" y="185.0" />
|
||||
<point x="474.875" y="185.0" />
|
||||
<point x="474.875" y="88.5" />
|
||||
<point x="-108.5" y="-0.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Bus" target="de.joethei.java1.zettel7.Fahrzeug">
|
||||
<point x="27.125" y="76.5" />
|
||||
<point x="630.5" y="217.0" />
|
||||
<point x="585.2954545454545" y="217.0" />
|
||||
<point x="81.375" y="-64.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Fahrzeug" target="de.joethei.java1.zettel7.Bus">
|
||||
<point x="27.125" y="-64.0" />
|
||||
<point x="531.0454545454545" y="217.0" />
|
||||
<point x="576.25" y="217.0" />
|
||||
<point x="-27.125" y="76.5" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.Fahrzeug" target="de.joethei.java1.zettel7.Fahrzeug">
|
||||
<point x="-81.375" y="64.0" />
|
||||
<point x="422.54545454545456" y="385.0" />
|
||||
<point x="375.42045454545456" y="385.0" />
|
||||
<point x="375.42045454545456" y="301.0" />
|
||||
<point x="-108.5" y="-0.0" />
|
||||
</edge>
|
||||
<edge source="de.joethei.java1.zettel7.LKW" target="de.joethei.java1.zettel7.LKW">
|
||||
<point x="-81.375" y="88.5" />
|
||||
<point x="265.0" y="197.0" />
|
||||
<point x="217.875" y="197.0" />
|
||||
<point x="217.875" y="88.5" />
|
||||
<point x="-108.5" y="-0.0" />
|
||||
</edge>
|
||||
</edges>
|
||||
<settings layout="Hierarchic Group" zoom="0.8270042194092827" x="298.88775510204084" y="461.4107142857143" />
|
||||
<SelectedNodes />
|
||||
<Categories>
|
||||
<Category>Fields</Category>
|
||||
<Category>Inner Classes</Category>
|
||||
<Category>Constructors</Category>
|
||||
<Category>Properties</Category>
|
||||
<Category>Methods</Category>
|
||||
</Categories>
|
||||
<SCOPE>All</SCOPE>
|
||||
<VISIBILITY>private</VISIBILITY>
|
||||
</Diagram>
|
||||
|
30
src/de/joethei/java1/zettel8/Angestellter.java
Normal file
30
src/de/joethei/java1/zettel8/Angestellter.java
Normal file
@ -0,0 +1,30 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public class Angestellter extends Person implements Gehaltsempfaenger_Interface {
|
||||
|
||||
private Gehaltsempfaenger gehaltsempfaenger;
|
||||
private String buero;
|
||||
|
||||
public Angestellter(Gehaltsempfaenger gehaltsempfaenger, String buero) {
|
||||
this.gehaltsempfaenger = gehaltsempfaenger;
|
||||
this.buero = buero;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGehalt() {
|
||||
return gehaltsempfaenger.getGehalt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGehalt(int gehalt) {
|
||||
gehaltsempfaenger.setGehalt(gehalt);
|
||||
}
|
||||
|
||||
public String getBuero() {
|
||||
return buero;
|
||||
}
|
||||
|
||||
public void setBuero(String buero) {
|
||||
this.buero = buero;
|
||||
}
|
||||
}
|
15
src/de/joethei/java1/zettel8/C.java
Normal file
15
src/de/joethei/java1/zettel8/C.java
Normal file
@ -0,0 +1,15 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public class C extends S1 implements S2_Interface{
|
||||
|
||||
private S2 s2;
|
||||
|
||||
@Override
|
||||
public void test() {
|
||||
s2.test();
|
||||
}
|
||||
|
||||
public C() {
|
||||
s2 = new S2();
|
||||
}
|
||||
}
|
16
src/de/joethei/java1/zettel8/Gehaltsempfaenger.java
Normal file
16
src/de/joethei/java1/zettel8/Gehaltsempfaenger.java
Normal file
@ -0,0 +1,16 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public class Gehaltsempfaenger implements Gehaltsempfaenger_Interface{
|
||||
|
||||
private int gehalt;
|
||||
|
||||
@Override
|
||||
public int getGehalt() {
|
||||
return gehalt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGehalt(int gehalt) {
|
||||
this.gehalt = gehalt;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public interface Gehaltsempfaenger_Interface {
|
||||
|
||||
int getGehalt();
|
||||
void setGehalt(int gehalt);
|
||||
|
||||
}
|
14
src/de/joethei/java1/zettel8/Person.java
Normal file
14
src/de/joethei/java1/zettel8/Person.java
Normal file
@ -0,0 +1,14 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public class Person {
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
8
src/de/joethei/java1/zettel8/S1.java
Normal file
8
src/de/joethei/java1/zettel8/S1.java
Normal file
@ -0,0 +1,8 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public class S1 {
|
||||
|
||||
public void test() {
|
||||
System.out.println("Test");
|
||||
}
|
||||
}
|
9
src/de/joethei/java1/zettel8/S2.java
Normal file
9
src/de/joethei/java1/zettel8/S2.java
Normal file
@ -0,0 +1,9 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public class S2 implements S2_Interface{
|
||||
|
||||
@Override
|
||||
public void test() {
|
||||
System.out.println("Test");
|
||||
}
|
||||
}
|
6
src/de/joethei/java1/zettel8/S2_Interface.java
Normal file
6
src/de/joethei/java1/zettel8/S2_Interface.java
Normal file
@ -0,0 +1,6 @@
|
||||
package de.joethei.java1.zettel8;
|
||||
|
||||
public interface S2_Interface {
|
||||
|
||||
void test();
|
||||
}
|
Loading…
Reference in New Issue
Block a user