diff --git a/Code/IMS-java b/Code/IMS-java deleted file mode 160000 index d3092e6..0000000 --- a/Code/IMS-java +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d3092e64bf931d5b98fa000fca03fa1069647646 diff --git a/Code/JavaOldCode/.vscode/settings.json b/Code/JavaOldCode/.vscode/settings.json new file mode 100644 index 0000000..3652cd9 --- /dev/null +++ b/Code/JavaOldCode/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ], + "java.format.settings.url": "eclipse-formatter.xml" +} diff --git a/Code/JavaOldCode/README.md b/Code/JavaOldCode/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/JavaOldCode/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/Code/JavaOldCode/bin/Archiv/Gaptext.class b/Code/JavaOldCode/bin/Archiv/Gaptext.class new file mode 100644 index 0000000..8d1715a Binary files /dev/null and b/Code/JavaOldCode/bin/Archiv/Gaptext.class differ diff --git a/Code/JavaOldCode/bin/Archiv/Sort.class b/Code/JavaOldCode/bin/Archiv/Sort.class new file mode 100644 index 0000000..2913930 Binary files /dev/null and b/Code/JavaOldCode/bin/Archiv/Sort.class differ diff --git a/Code/JavaOldCode/bin/Archiv/Yoda.class b/Code/JavaOldCode/bin/Archiv/Yoda.class new file mode 100644 index 0000000..710eb51 Binary files /dev/null and b/Code/JavaOldCode/bin/Archiv/Yoda.class differ diff --git a/Code/JavaOldCode/bin/Archiv/exchange.class b/Code/JavaOldCode/bin/Archiv/exchange.class new file mode 100644 index 0000000..b6e01da Binary files /dev/null and b/Code/JavaOldCode/bin/Archiv/exchange.class differ diff --git a/Code/JavaOldCode/bin/Grundlagen.class b/Code/JavaOldCode/bin/Grundlagen.class new file mode 100644 index 0000000..c985256 Binary files /dev/null and b/Code/JavaOldCode/bin/Grundlagen.class differ diff --git a/Code/JavaOldCode/bin/Testcode.class b/Code/JavaOldCode/bin/Testcode.class new file mode 100644 index 0000000..d0a81bd Binary files /dev/null and b/Code/JavaOldCode/bin/Testcode.class differ diff --git a/Code/JavaOldCode/src/Archiv/Gaptext.java b/Code/JavaOldCode/src/Archiv/Gaptext.java new file mode 100644 index 0000000..8fccecc --- /dev/null +++ b/Code/JavaOldCode/src/Archiv/Gaptext.java @@ -0,0 +1,46 @@ +package Archiv; + +import javax.swing.JOptionPane; + +public class Gaptext { + public static void main(String[] args) { + // Lückentexte / kombination aus variablen, print und if/else + + // Popups mit User Input + String a = JOptionPane.showInputDialog("Please enter a verb (-ing):"); + String b = JOptionPane.showInputDialog("Please enter a location:"); + String c = JOptionPane.showInputDialog("Please enter a color:"); + String d = JOptionPane.showInputDialog("Please enter something that's that color:"); + String e = JOptionPane.showInputDialog("Please enter a diffrent color:"); + String f = JOptionPane.showInputDialog("Please enter something that's that color:"); + String g = JOptionPane.showInputDialog("Please enter an adjective:"); + String h = JOptionPane.showInputDialog("Please enter an object"); + + // Error message + + if (a == null || a.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (b == null || b.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (c == null || c.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (d == null || d.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (e == null || e.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (f == null || f.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (g == null || g.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else if (h == null || h.trim().isEmpty()) { + System.out.println("Missing word(s) or canceled."); + } else { + + // Lückentext mit variablen + + System.out.println("They where " + a + " throw (a) " + b + ". They're eyes where "); + System.out.println(c + " as (the) " + d + " They're hair as " + e + " as (the) " + f + "."); + System.out.println("It was a " + g + " day, after a long journey they finally found their " + h); + } + } +} \ No newline at end of file diff --git a/Code/JavaOldCode/src/Archiv/Sort.java b/Code/JavaOldCode/src/Archiv/Sort.java new file mode 100644 index 0000000..52babb2 --- /dev/null +++ b/Code/JavaOldCode/src/Archiv/Sort.java @@ -0,0 +1,33 @@ +package Archiv; + +import java.util.Random; + +public class Sort { + public static void main(String[] args) throws Exception { + // Creating a Random object + Random random = new Random(); + + // Define the range for variables + int minRange = -10000; + int maxRange = 10000; + + // Generate random values + int a = random.nextInt(maxRange - minRange + 1) + minRange; + int b = random.nextInt(maxRange - minRange + 1) + minRange; + int c = random.nextInt(maxRange - minRange + 1) + minRange; + + System.out.println("a equals:" + a); + System.out.println("b equals:" + b); + System.out.println("c equals:" + c); + + if (a > b && a > c) { + System.out.println("The largest variable is: a"); + } else if (b > a && b > c) { + System.out.println("The largest variable is: b"); + } else if (c > a && c > b) { + System.out.println("The largest variable is: c"); + } else + System.out.println("All variables have the same value"); + + } +} diff --git a/Code/JavaOldCode/src/Archiv/Yoda.java b/Code/JavaOldCode/src/Archiv/Yoda.java new file mode 100644 index 0000000..847cebd --- /dev/null +++ b/Code/JavaOldCode/src/Archiv/Yoda.java @@ -0,0 +1,32 @@ +package Archiv; + +import java.util.Random; + +public class Yoda { + public static void main(String[] args) { + // Print text + + System.out.println("A code request you have made,"); + System.out.println("Fear not, for I am here to aid."); + System.out.println("In Java, a language so grand,"); + System.out.println("I'll lend you a helping hand."); + + // Creating a Random object + Random random = new Random(); + + // Define the range for xx, yy and zz + int minRange = -10000; + int maxRange = 10000; + + // Generate random values for xx, zz and yy within the specified range + int xx = random.nextInt(maxRange - minRange + 1) + minRange; + int yy = random.nextInt(maxRange - minRange + 1) + minRange; + int zz = random.nextInt(maxRange - minRange + 1) + minRange; + + int sum = xx + yy + zz; + + System.out.println("The sum of " + xx + ", " + yy + " and " + zz + " is: " + sum); + + System.out.println("May the code be with you!"); + } +} \ No newline at end of file diff --git a/Code/JavaOldCode/src/Archiv/exchange.java b/Code/JavaOldCode/src/Archiv/exchange.java new file mode 100644 index 0000000..0066118 --- /dev/null +++ b/Code/JavaOldCode/src/Archiv/exchange.java @@ -0,0 +1,33 @@ +package Archiv; + +public class exchange { + public static void main(String[] args) { + + int x = 5; + int y = 7; + + // Vor dem Tausch + System.out.println(x); + System.out.println(y); + + // Tausch + int z = 0; + z = x; + x = y; + y = z; + + // Nach dem Tausch + System.out.println(x); + System.out.println(y); + + /* + * Tauschen Sie die Inhalte der beiden Variablen! D. h.: Wenn vor dem + * Tausch x den Wert 5 hatte und y den Wert 7, dann soll x nach dem + * Tausch den Wert 7 haben und y den Wert 5. Führen Sie den Tausch + * so durch, dass der Tausch funktioniert, egal mit welchen Werten x + * und y initialisiert wurden. + * Sie dürfen nur Code zwischen den beiden Kommentaren //Tausch + * und //Nach dem Tausch hinzufügen! + */ + } +} \ No newline at end of file diff --git a/Code/JavaOldCode/src/Grundlagen.java b/Code/JavaOldCode/src/Grundlagen.java new file mode 100644 index 0000000..0b6d386 --- /dev/null +++ b/Code/JavaOldCode/src/Grundlagen.java @@ -0,0 +1,61 @@ +public class Grundlagen { + public static void main(String[] args) { + + // Hello World + System.out.println("Hello World"); + + // Zahlen Variablen + int x = 99; + int y = 2; + x = x + 1; + x = x + y; + System.out.println(x); + + // Buchstaben Variablen + char myA = 'a'; + System.out.println(myA); + + // If & else + if (x > 101) { + System.out.println("Der Wert ist grösser als 101"); + } else { + System.out.println("Der Wert ist kleiner als 101"); + } + + // Iteration + int anzahlDurchgaenge = 1; + while (anzahlDurchgaenge <= 5) { + System.out.println("Durchgang nr. " + anzahlDurchgaenge); + anzahlDurchgaenge += 1; + } + + // Datentypen + byte myByte = 127; + short myShort = 300; + + // With float the f is necassary because java otherwise treats it as a double + // (simplified anwser) + double myDoubleValue = 34.568956; + float myFloatValue = 17.567f; + + // Constant always uppercase // Fixed Number + + final double PI = 3.141592876; + + int xx = 0; + long yy = 2; + xx++; // inkrement + xx--; // dekrement + + xx += (int) y; // Making y (long) a int for calculation + xx += 1; // Short for x = x +1 + yy += 4; // Short for y = y +4 + yy %= 3; // short for y = y%3 %=Modulo (Ganzahliges Geteiltdurch) + + // Square root + double d1 = Math.sqrt(10); + + System.out.println(d1 + "noch etwas schreiben" + d1); + + } +} \ No newline at end of file diff --git a/Code/JavaOldCode/src/Testcode.java b/Code/JavaOldCode/src/Testcode.java new file mode 100644 index 0000000..7a532fb --- /dev/null +++ b/Code/JavaOldCode/src/Testcode.java @@ -0,0 +1,5 @@ +public class Testcode { + public static void main(String[] args) { + + } +}