diff --git a/Uebung_3/.idea/.gitignore b/GDP_Gesamt/.idea/.gitignore similarity index 100% rename from Uebung_3/.idea/.gitignore rename to GDP_Gesamt/.idea/.gitignore diff --git a/Uebung_3/.idea/misc.xml b/GDP_Gesamt/.idea/misc.xml similarity index 72% rename from Uebung_3/.idea/misc.xml rename to GDP_Gesamt/.idea/misc.xml index 35fb8b9..91063aa 100644 --- a/Uebung_3/.idea/misc.xml +++ b/GDP_Gesamt/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Uebung_3/.idea/modules.xml b/GDP_Gesamt/.idea/modules.xml similarity index 60% rename from Uebung_3/.idea/modules.xml rename to GDP_Gesamt/.idea/modules.xml index 981cb8a..47e7243 100644 --- a/Uebung_3/.idea/modules.xml +++ b/GDP_Gesamt/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/GDP_Gesamt/.idea/vcs.xml b/GDP_Gesamt/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/GDP_Gesamt/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Uebung_3/Uebung03.iml b/GDP_Gesamt/GDP_Gesamt.iml similarity index 100% rename from Uebung_3/Uebung03.iml rename to GDP_Gesamt/GDP_Gesamt.iml diff --git a/Uebung_1/GdP-Uebung01-v1_8.10.2020.pdf b/GDP_Gesamt/aufgaben/GdP-Uebung01-v1_8.10.2020.pdf similarity index 100% rename from Uebung_1/GdP-Uebung01-v1_8.10.2020.pdf rename to GDP_Gesamt/aufgaben/GdP-Uebung01-v1_8.10.2020.pdf diff --git a/Uebung_2/GdP-Uebung02-v1.pdf b/GDP_Gesamt/aufgaben/GdP-Uebung02-v1.pdf similarity index 100% rename from Uebung_2/GdP-Uebung02-v1.pdf rename to GDP_Gesamt/aufgaben/GdP-Uebung02-v1.pdf diff --git a/Uebung_3/GdP-Uebung03-v1.pdf b/GDP_Gesamt/aufgaben/GdP-Uebung03-v1.pdf similarity index 100% rename from Uebung_3/GdP-Uebung03-v1.pdf rename to GDP_Gesamt/aufgaben/GdP-Uebung03-v1.pdf diff --git a/Uebung_4/GdP-Uebung04-v1.pdf b/GDP_Gesamt/aufgaben/GdP-Uebung04-v1.pdf similarity index 100% rename from Uebung_4/GdP-Uebung04-v1.pdf rename to GDP_Gesamt/aufgaben/GdP-Uebung04-v1.pdf diff --git a/GDP_Gesamt/aufgaben/GdP-Uebung05-v1.pdf b/GDP_Gesamt/aufgaben/GdP-Uebung05-v1.pdf new file mode 100644 index 0000000..0a174d2 Binary files /dev/null and b/GDP_Gesamt/aufgaben/GdP-Uebung05-v1.pdf differ diff --git a/GDP_Gesamt/src/Livecoding/Methoden.java b/GDP_Gesamt/src/Livecoding/Methoden.java new file mode 100644 index 0000000..02ea9d0 --- /dev/null +++ b/GDP_Gesamt/src/Livecoding/Methoden.java @@ -0,0 +1,29 @@ +package Livecoding; + +public class Methoden { + public static void main(String[]args){ + sop("Zinseszins: "); + //sop(Double.toString(zinseszins(50,2,5)),true); + sop(runden(zinseszins(50,2,5),2),true); + //sop(Double.toString(zinsesZinsmitZinsanstieg(500, 30))); + sop(runden(zinsesZinsmitZinsanstieg(500, 30),2),true); + } + private static void sop(String input){ + System.out.print(input); + } + private static void sop(String input, boolean newline){ + System.out.println(input); + } + private static double zinseszins(double startguthaben, double zinsSatz, int anlageJahre){ + double res; + res = startguthaben*Math.pow(1+zinsSatz/100, anlageJahre); + return res; + } + private static int zinsesZinsmitZinsanstieg(int K, int p){ + return (K*(p+1))/1; + } + public static String runden(double wert, int dezi){ + return String.format("%." + dezi + "f",wert); + } + +} diff --git a/GDP_Gesamt/src/Livecoding/Spicker.java b/GDP_Gesamt/src/Livecoding/Spicker.java new file mode 100644 index 0000000..09f1bc1 --- /dev/null +++ b/GDP_Gesamt/src/Livecoding/Spicker.java @@ -0,0 +1,72 @@ +package Livecoding; + +public class Spicker { + public static void main(String[] args){ + // impliziter cast + int intZahl = 1; + double dZahl = intZahl; + + // expliziter Cast + dZahl = 1.9; + intZahl = (int) dZahl; + + boolean istGut = true; + int zahl = 0; + if(!istGut){ + System.out.println("A"); + } else if(istGut && zahl == 0){ + System.out.print("C"); + } else { + System.out.println("B"); + } + + //... weiter im Text + + + // Switch + int a = 1; + switch(a){ + case 1: + System.out.print("Hallo"); + break; + case 2: + System.out.print("Ciao"); + break; + default: + System.out.print("Nix passiert"); + } + + // Schleifen + int b = 0, c = 0, d=0; + while(b<010) {b++; } + do{c++;}while(c<=10); + + for(int i1= 0; i1<=10; i1++) {d++;} + + // Methoden + methodenOhneReturn(b); + + int f = methodeMitReturn(2,5); + + // arrays: + int[] meinArray = new int[] {3,5,3,2}; + int[] meinArray2 = new int[4]; + // meinArray[0] = 3; //... + for(int i=0; i "); + for(int i=0; i<=numAmount;i++){ + numbers[i] = i+rangeMin; + //System.out.print("number["+i+"]="+(i+rangeMin)+" "); + } + System.out.println(); + System.out.print("Prime numbers => "); + for(int number:numbers){ + if(isPrime(number)) System.out.print(number + ", "); + } + } + public static boolean isPrime(int number){ + boolean res=true; // output variable + // test through all divisors form 2 to number-1 + for(int i=2;i increment counter + // now remove all similar chars from that point till the end of the array + for (int j = i + 1; j < workingArray.length; j++) { + if (workingArray[i] == workingArray[j]) workingArray[j] = (char) 0; // set the char to "Null character" + } + } + } + char[] targetArray = new char[counter]; // create new + int targetPosition = 0; // initiate counter for the Target Array + for(char currChar:workingArray){ // seek through all chars + if((int)currChar!=0){ // if its not a null character it is a new char + targetArray[targetPosition] = currChar; // add the current char + targetPosition++; // we added a new char, so we need to increment for the next one + } + } + return targetArray; + } +} diff --git a/Uebung_1/.vscode/settings.json b/Uebung_1/.vscode/settings.json deleted file mode 100644 index 2421e38..0000000 --- a/Uebung_1/.vscode/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files.exclude": { - "**/.classpath": true, - "**/.project": true, - "**/.settings": true, - "**/.factorypath": true - } -} \ No newline at end of file diff --git a/Uebung_1/A1/SumTemplate/SumTemplate.class b/Uebung_1/A1/SumTemplate/SumTemplate.class deleted file mode 100644 index a9c62eb..0000000 Binary files a/Uebung_1/A1/SumTemplate/SumTemplate.class and /dev/null differ diff --git a/Uebung_1/A1/SumTemplate/SumTemplate.java b/Uebung_1/A1/SumTemplate/SumTemplate.java deleted file mode 100644 index ff95d00..0000000 --- a/Uebung_1/A1/SumTemplate/SumTemplate.java +++ /dev/null @@ -1,26 +0,0 @@ -public class SumTemplate { - public static void main(String[] args){ - // Ganze Zahl, bis zu der summiert wird - int boundary; - // Summe der bisher addierten ganzen Zahlen - int sum; - // Ganze Zahl - int counter; - - // Festlegen der Startwerte - boundary = 4; - sum = 0; - counter = 1; - - // Berechnen der Summe sum über alle Zahlen von 1 bis boundary - while(counter <= boundary){ - sum = sum + counter; - counter = counter + 1; - } - // Ausgaben der Summe, gemeinsam mit erläuterndem Text - System.out.print("Die Summe der Zahlen von 1 bis "); - System.out.print(boundary); - System.out.print(" ist "); - System.out.print(sum); - } -} diff --git a/Uebung_1/HelloWorld/HelloWorld.class b/Uebung_1/HelloWorld/HelloWorld.class deleted file mode 100644 index 2f914c2..0000000 Binary files a/Uebung_1/HelloWorld/HelloWorld.class and /dev/null differ diff --git a/Uebung_1/Sum/Sum.class b/Uebung_1/Sum/Sum.class deleted file mode 100644 index 14e4862..0000000 Binary files a/Uebung_1/Sum/Sum.class and /dev/null differ diff --git a/Uebung_2/Aufgabe1/Variablen.class b/Uebung_2/Aufgabe1/Variablen.class deleted file mode 100644 index 6fb7bde..0000000 Binary files a/Uebung_2/Aufgabe1/Variablen.class and /dev/null differ diff --git a/Uebung_2/Aufgabe2/Variablen.class b/Uebung_2/Aufgabe2/Variablen.class deleted file mode 100644 index 6fb7bde..0000000 Binary files a/Uebung_2/Aufgabe2/Variablen.class and /dev/null differ diff --git a/Uebung_2/Aufgabe2/Variablen.java b/Uebung_2/Aufgabe2/Variablen.java deleted file mode 100644 index da6f1ab..0000000 --- a/Uebung_2/Aufgabe2/Variablen.java +++ /dev/null @@ -1,21 +0,0 @@ -public class Variablen{ - public static void main(String[]args){ - byte bVar1 = 5; - short sVar1 = 400; - int iVar1 = -35676; - long lVar1 = 100000000L; - float fVar1 = 0.123f; - double dVar1 = 0.123; - boolean istPrim1 = false; - char cVar1 = 'x'; - System.out.println(); - System.out.println(bVar1); - System.out.println(sVar1); - System.out.println(iVar1); - System.out.println(lVar1); - System.out.println(fVar1); - System.out.println(dVar1); - System.out.println(cVar1); - System.out.println(istPrim1); - } -} \ No newline at end of file diff --git a/Uebung_2/Aufgabe3/Verdienstrechner.class b/Uebung_2/Aufgabe3/Verdienstrechner.class deleted file mode 100644 index b3ab459..0000000 Binary files a/Uebung_2/Aufgabe3/Verdienstrechner.class and /dev/null differ diff --git a/Uebung_2/Aufgabe4/Verdienstrechner.class b/Uebung_2/Aufgabe4/Verdienstrechner.class deleted file mode 100644 index 21144db..0000000 Binary files a/Uebung_2/Aufgabe4/Verdienstrechner.class and /dev/null differ diff --git a/Uebung_2/Aufgabe4/Verdienstrechner.java b/Uebung_2/Aufgabe4/Verdienstrechner.java deleted file mode 100644 index d61a8d5..0000000 --- a/Uebung_2/Aufgabe4/Verdienstrechner.java +++ /dev/null @@ -1,35 +0,0 @@ -import java.util.Scanner; - -public class Verdienstrechner { - public static void main(String[] args) { - float stunden = 9f; - float stundenlohn = 12.0f; - float ueStundenlohn = 17.5f; - float ueStunden = 0; - float regArbeitszeit = 8; - Scanner scan = new Scanner(System.in); - System.out.print("Standardwerte verwenden? [J/n]: "); - if (scan.nextLine().equalsIgnoreCase("n")) { - System.out.print("\nDeine regulaere Arbeitszeit: "); - regArbeitszeit = scan.nextFloat(); - System.out.print("\nWie viel verdienst du in der Stunde?: "); - stundenlohn = scan.nextFloat(); - System.out.print("\n Wie viel Stunden hast du gearbeitet?: "); - stunden = scan.nextFloat(); - System.out.print("\n Wie viel verdienst du bei Überstunden?:"); - ueStundenlohn = scan.nextFloat(); - } - System.out.println("------ BERECHNE-------\n"); - System.out.println("Stundenlohn: " + stundenlohn); - System.out.println("Stunden insgesamt: " + stunden); - if (stunden > regArbeitszeit) { - ueStunden = stunden - regArbeitszeit; - System.out.println("Ueberstunden: " + ueStunden); - stunden = 8; - } - float verdienst = stunden * stundenlohn + ueStundenlohn * ueStunden; - - System.out.println("Ich habe " + verdienst + " verdient."); - scan.close(); - } -} \ No newline at end of file diff --git a/Uebung_3/out/production/Uebung03/CountDown.class b/Uebung_3/out/production/Uebung03/CountDown.class deleted file mode 100644 index 00e24c2..0000000 Binary files a/Uebung_3/out/production/Uebung03/CountDown.class and /dev/null differ diff --git a/Uebung_3/out/production/Uebung03/Kreis.class b/Uebung_3/out/production/Uebung03/Kreis.class deleted file mode 100644 index f853d0c..0000000 Binary files a/Uebung_3/out/production/Uebung03/Kreis.class and /dev/null differ diff --git a/Uebung_3/out/production/Uebung03/Liveuebung.class b/Uebung_3/out/production/Uebung03/Liveuebung.class deleted file mode 100644 index c7cdd9d..0000000 Binary files a/Uebung_3/out/production/Uebung03/Liveuebung.class and /dev/null differ diff --git a/Uebung_3/out/production/Uebung03/SatellitenZeit.class b/Uebung_3/out/production/Uebung03/SatellitenZeit.class deleted file mode 100644 index 5daeabe..0000000 Binary files a/Uebung_3/out/production/Uebung03/SatellitenZeit.class and /dev/null differ diff --git a/Uebung_3/out/production/Uebung03/ScannerBeispiel.class b/Uebung_3/out/production/Uebung03/ScannerBeispiel.class deleted file mode 100644 index 3a04590..0000000 Binary files a/Uebung_3/out/production/Uebung03/ScannerBeispiel.class and /dev/null differ diff --git a/Uebung_3/out/production/Uebung03/Steuer.class b/Uebung_3/out/production/Uebung03/Steuer.class deleted file mode 100644 index 55160e0..0000000 Binary files a/Uebung_3/out/production/Uebung03/Steuer.class and /dev/null differ diff --git a/Uebung_3/out/production/Uebung03/Temperatur.class b/Uebung_3/out/production/Uebung03/Temperatur.class deleted file mode 100644 index e611b35..0000000 Binary files a/Uebung_3/out/production/Uebung03/Temperatur.class and /dev/null differ diff --git a/Uebung_3/src/CountDown.java b/Uebung_3/src/CountDown.java deleted file mode 100644 index 738c2b9..0000000 --- a/Uebung_3/src/CountDown.java +++ /dev/null @@ -1,6 +0,0 @@ -public class CountDown { - public static void main(String[] args){ - System.out.println(); - - } -} diff --git a/Uebung_3/src/Liveuebung.java b/Uebung_3/src/Liveuebung.java deleted file mode 100644 index 03f5ce2..0000000 --- a/Uebung_3/src/Liveuebung.java +++ /dev/null @@ -1,35 +0,0 @@ -public class Liveuebung { - public static void crazyLoop(String[] args){ - int zaehler= 0; - while(zaehler < 3){ - System.out.println(zaehler++); - - } - } - public static int calc(int[] numbers){ - int sum = 0; - for(int i=numbers.length-1;i>=0;i--){ - sum += numbers[i]; - } - return sum*sum; - } - - public static int calc2(int... numbers){ - int sum=0; - for(int number:numbers){ - sum += number; - } - return sum*sum; - } - public static void main(String[] args){ - int[] input = {1,2,3}; - int ret = calc(input); - System.out.println("Ergebnis: " + ret); - System.out.println("Anzahl " + input.length); - System.out.println("-----------------"); - System.out.println("Rechne" + calc2(1,2,3)); - - - } - -} diff --git a/Uebung_3/src/ScannerBeispiel.java b/Uebung_3/src/ScannerBeispiel.java deleted file mode 100644 index 08d613c..0000000 --- a/Uebung_3/src/ScannerBeispiel.java +++ /dev/null @@ -1,14 +0,0 @@ -import java.util.Scanner; -public class ScannerBeispiel { - public static void main(String[] args){ - Scanner scanner = new Scanner(System.in); - byte byteWert = Byte.parseByte(scanner.nextLine()); - short shortWert = Short.parseShort(scanner.nextLine()); - int intWert = Integer.parseInt(scanner.nextLine()); - long longWert = Long.parseLong(scanner.nextLine()); - float floatWert = Float.parseFloat(scanner.nextLine()); - double doubleWert = Double.parseDouble(scanner.nextLine()); - boolean booleanWert = Boolean.parseBoolean(scanner.nextLine()); - scanner.close(); - } -} diff --git a/Uebung_4/.idea/.gitignore b/Uebung_4/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/Uebung_4/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/Uebung_4/.idea/misc.xml b/Uebung_4/.idea/misc.xml deleted file mode 100644 index 35fb8b9..0000000 --- a/Uebung_4/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Uebung_4/.idea/modules.xml b/Uebung_4/.idea/modules.xml deleted file mode 100644 index 4fc6c51..0000000 --- a/Uebung_4/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Uebung_4/U4.iml b/Uebung_4/U4.iml deleted file mode 100644 index c90834f..0000000 --- a/Uebung_4/U4.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Uebung_4/out/production/U4/Maximum.class b/Uebung_4/out/production/U4/Maximum.class deleted file mode 100644 index 303cdb5..0000000 Binary files a/Uebung_4/out/production/U4/Maximum.class and /dev/null differ diff --git a/Uebung_4/out/production/U4/Schnittmenge.class b/Uebung_4/out/production/U4/Schnittmenge.class deleted file mode 100644 index 0db11c6..0000000 Binary files a/Uebung_4/out/production/U4/Schnittmenge.class and /dev/null differ diff --git a/Uebung_4/out/production/U4/Wechselgeld.class b/Uebung_4/out/production/U4/Wechselgeld.class deleted file mode 100644 index 5761e9f..0000000 Binary files a/Uebung_4/out/production/U4/Wechselgeld.class and /dev/null differ