diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/.vscode/settings.json b/Code/Steiner/30-10-2024-Prüfung-teil2/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung-teil2/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/README.md b/Code/Steiner/30-10-2024-Prüfung-teil2/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung-teil2/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/Steiner/30-10-2024-Prüfung-teil2/bin/App.class b/Code/Steiner/30-10-2024-Prüfung-teil2/bin/App.class new file mode 100644 index 0000000..74d6cf4 Binary files /dev/null and b/Code/Steiner/30-10-2024-Prüfung-teil2/bin/App.class differ diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/bin/Person.class b/Code/Steiner/30-10-2024-Prüfung-teil2/bin/Person.class new file mode 100644 index 0000000..fe31281 Binary files /dev/null and b/Code/Steiner/30-10-2024-Prüfung-teil2/bin/Person.class differ diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/bin/Zimmer.class b/Code/Steiner/30-10-2024-Prüfung-teil2/bin/Zimmer.class new file mode 100644 index 0000000..4f903cd Binary files /dev/null and b/Code/Steiner/30-10-2024-Prüfung-teil2/bin/Zimmer.class differ diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/src/App.java b/Code/Steiner/30-10-2024-Prüfung-teil2/src/App.java new file mode 100644 index 0000000..13e2408 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung-teil2/src/App.java @@ -0,0 +1,21 @@ +// Luca Fabian Burger +// Aufgabe 3 +public class App { + public static void main(String[] args) throws Exception { + // Zimmer erstellen + Zimmer[] zimmers = new Zimmer[3]; + zimmers[0] = new Zimmer(1, 6); // Zimmer 1, 6 Personen Kapazität + zimmers[1] = new Zimmer(2, 2); + zimmers[2] = new Zimmer(3, 10); + // Einige Personen zu Zimmer hinzufügen + zimmers[0].hinzufuegenPerson(new Person("Fritz", false)); // Name, Geschlecht + zimmers[1].hinzufuegenPerson(new Person("Anna", true)); + zimmers[1].hinzufuegenPerson(new Person("Lena", true)); + // Informationen ausgeben + for (Zimmer zimmer : zimmers) { + System.out.println( + "Personen im Zimmer " + zimmer.getNummer() + " (Belegung " + zimmer.belegung() + "):"); + zimmer.printPersonenListe(); + } + } +} diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/src/Person.java b/Code/Steiner/30-10-2024-Prüfung-teil2/src/Person.java new file mode 100644 index 0000000..75b733b --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung-teil2/src/Person.java @@ -0,0 +1,28 @@ +// Luca Fabian Burger +// Aufgabe 3 +public class Person { + private String name; + private boolean geschlecht; + + Person(String name, boolean geschlecht) { + this.name = name; + this.geschlecht = geschlecht; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isGeschlecht() { + return geschlecht; + } + + public void setGeschlecht(boolean geschlecht) { + this.geschlecht = geschlecht; + } + +} diff --git a/Code/Steiner/30-10-2024-Prüfung-teil2/src/Zimmer.java b/Code/Steiner/30-10-2024-Prüfung-teil2/src/Zimmer.java new file mode 100644 index 0000000..cbf4013 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung-teil2/src/Zimmer.java @@ -0,0 +1,56 @@ +// Luca Fabian Burger +// Aufgabe 3 +public class Zimmer { + private int zimmernummer; + private int kapazitaet; + // Problem nicht hinbekommen dynamisch + private Person[] personen = new Person[10]; + private int belegungZimmer = 0; + + Zimmer(int zimmerNummer, int kapazitaet) { + this.zimmernummer = zimmerNummer; + this.kapazitaet = kapazitaet; + } + + void hinzufuegenPerson(Person person) { + if (belegungZimmer < personen.length) { + if (belegungZimmer != 0) { + if (personen[belegungZimmer--] != personen[belegungZimmer]) { + this.personen[belegungZimmer] = person; + belegungZimmer++; + } else { + System.out.println("Error mehr als ein geschlecht im Raum"); + } + } else { + this.personen[belegungZimmer] = person; + belegungZimmer++; + } + } else { + System.out.println("Zimmer ausgebucht"); + } + } + + int getNummer() { + return this.zimmernummer; + } + + String belegung() { + return belegungZimmer + "/" + kapazitaet; + } + + // funktioniert nicht + String printPersonenListe() { + String personenListe = ""; + for (int i = 0; i < this.belegungZimmer; i++) { + personenListe += "- "; + personenListe += personen[i].getName(); + boolean temp = personen[i].isGeschlecht(); + if (temp) + personenListe += ": " + "männlich"; + else + personenListe += ": " + "weiblich"; + personenListe += "\n"; + } + return personenListe; + } +} diff --git a/Code/Steiner/30-10-2024-Prüfung/.vscode/settings.json b/Code/Steiner/30-10-2024-Prüfung/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/Code/Steiner/30-10-2024-Prüfung/README.md b/Code/Steiner/30-10-2024-Prüfung/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung/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/Steiner/30-10-2024-Prüfung/bin/App.class b/Code/Steiner/30-10-2024-Prüfung/bin/App.class new file mode 100644 index 0000000..32f3c3b Binary files /dev/null and b/Code/Steiner/30-10-2024-Prüfung/bin/App.class differ diff --git a/Code/Steiner/30-10-2024-Prüfung/bin/Datum.class b/Code/Steiner/30-10-2024-Prüfung/bin/Datum.class new file mode 100644 index 0000000..f27176c Binary files /dev/null and b/Code/Steiner/30-10-2024-Prüfung/bin/Datum.class differ diff --git a/Code/Steiner/30-10-2024-Prüfung/src/App.java b/Code/Steiner/30-10-2024-Prüfung/src/App.java new file mode 100644 index 0000000..f529598 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung/src/App.java @@ -0,0 +1,21 @@ +// Luca Fabian Burger +// Aufgabe 2 +public class App { + public static void main(String[] args) throws Exception { + Datum datum1 = new Datum(1, 1, 2000); + Datum datum2 = new Datum(1, 1, 2000); + // Aufgabe a + System.out.println(datum1.getDifferent(datum2)); + // Aufgabe b + System.out.println(datum1.getWochentag()); + // Aufagbe c + datum1.addTage(2); + System.out.println(datum1.getTag()); + // Aufgabe d + System.out.println(datum1.getTag() + " " + datum1.getMonat() + " " + datum1.getJahr()); + // Aufgabe e + System.out.println(datum1.getDatumNummerisch()); + // Aufgabe f + System.out.println(datum1.getDatumMonat()); + } +} \ No newline at end of file diff --git a/Code/Steiner/30-10-2024-Prüfung/src/Datum.java b/Code/Steiner/30-10-2024-Prüfung/src/Datum.java new file mode 100644 index 0000000..6097dc5 --- /dev/null +++ b/Code/Steiner/30-10-2024-Prüfung/src/Datum.java @@ -0,0 +1,119 @@ +// Luca Fabian Burger +// Aufgabe 2 +public class Datum { + private int tag; + private int monat; + private int jahr; + + Datum(int tag, int monat, int jahr) { + this.tag = tag; + this.monat = monat; + this.jahr = jahr; + } + + public void setTag(int tag) { + this.tag = tag; + } + + public void setMonat(int monat) { + if (monat <= 12 && monat >= 0) + this.monat = monat; + else + this.monat = 1; + } + + public void setJahr(int jahr) { + this.jahr = jahr; + } + + // Aufgabe a + int getDifferent(Datum datum) { + // Logic + return 12; + } + + // Aufgabe b + String getWochentag() { + // Logic + return "Montag"; + } + + // Aufgabe C + void addTage(int anzahlTage) { + this.tag += anzahlTage; + } + + // Aufgabe d + public int getTag() { + return tag; + } + + public int getMonat() { + return monat; + } + + public int getJahr() { + return jahr; + } + + // Aufgabe e + String getDatumNummerisch() { + String rueckgabe = ""; + rueckgabe += this.tag + ". "; + rueckgabe += this.monat + ". "; + rueckgabe += this.jahr; + return rueckgabe; + } + + // Aufgabe f + String getDatumMonat() { + String rueckgabe = ""; + String monatString = ""; + switch (this.monat) { + case 1: + monatString = "Januar"; + break; + case 2: + monatString = "Februar"; + break; + case 3: + monatString = "März"; + break; + case 4: + monatString = "April"; + break; + case 5: + monatString = "Mai"; + break; + case 6: + monatString = "Juni"; + break; + case 7: + monatString = "Juli"; + break; + case 8: + monatString = "August"; + break; + case 9: + monatString = "September"; + break; + case 10: + monatString = "Oktober"; + break; + case 11: + monatString = "November"; + break; + case 12: + monatString = "Dezember"; + break; + default: + monatString = "Januar"; + break; + } + rueckgabe += this.tag + ". "; + rueckgabe += monatString + " "; + rueckgabe += this.jahr; + return rueckgabe; + } + +} diff --git a/Code/Steiner/30.10.24-Player-Klasse/.vscode/settings.json b/Code/Steiner/30.10.24-Player-Klasse/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/30.10.24-Player-Klasse/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/Code/Steiner/30.10.24-Player-Klasse/README.md b/Code/Steiner/30.10.24-Player-Klasse/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/30.10.24-Player-Klasse/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/Steiner/30.10.24-Player-Klasse/bin/Player.class b/Code/Steiner/30.10.24-Player-Klasse/bin/Player.class new file mode 100644 index 0000000..4ef2308 Binary files /dev/null and b/Code/Steiner/30.10.24-Player-Klasse/bin/Player.class differ diff --git a/Code/Steiner/30.10.24-Player-Klasse/bin/PlayerTest.class b/Code/Steiner/30.10.24-Player-Klasse/bin/PlayerTest.class new file mode 100644 index 0000000..af5c696 Binary files /dev/null and b/Code/Steiner/30.10.24-Player-Klasse/bin/PlayerTest.class differ diff --git a/Code/Steiner/30.10.24-Player-Klasse/src/Player.class b/Code/Steiner/30.10.24-Player-Klasse/src/Player.class new file mode 100644 index 0000000..c46e3f4 Binary files /dev/null and b/Code/Steiner/30.10.24-Player-Klasse/src/Player.class differ diff --git a/Code/Steiner/30.10.24-Player-Klasse/src/Player.java b/Code/Steiner/30.10.24-Player-Klasse/src/Player.java new file mode 100644 index 0000000..b4871b6 --- /dev/null +++ b/Code/Steiner/30.10.24-Player-Klasse/src/Player.java @@ -0,0 +1,27 @@ +public class Player { + private int id; + private String name; + private static int counter = 1; + + Player(String name) { + this.id = counter; + counter++; + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/Code/Steiner/30.10.24-Player-Klasse/src/PlayerTest.class b/Code/Steiner/30.10.24-Player-Klasse/src/PlayerTest.class new file mode 100644 index 0000000..eb2a20d Binary files /dev/null and b/Code/Steiner/30.10.24-Player-Klasse/src/PlayerTest.class differ diff --git a/Code/Steiner/30.10.24-Player-Klasse/src/PlayerTest.java b/Code/Steiner/30.10.24-Player-Klasse/src/PlayerTest.java new file mode 100644 index 0000000..bbb6d05 --- /dev/null +++ b/Code/Steiner/30.10.24-Player-Klasse/src/PlayerTest.java @@ -0,0 +1,13 @@ +public class PlayerTest { + public static void main(String[] args) { + Player[] players = new Player[20]; + String[] names = { "Eva", "Fritz", "Anna", "Luca", "Sara", "Max", "Zoe", "Leo", "Nina", "Tom", + "Ella", "Jake", "Mia", "Liam", "Sophie", "Noah", "Emma", "Ben", "Olivia", "Eli" }; + for (int i = 0; i < players.length; i++) { + players[i] = new Player(names[i]); + } + for (Player player : players) { + System.out.println(player.getId() + " " + player.getName()); + } + } +} \ No newline at end of file diff --git a/Code/Steiner/CO2-Daten-Projekt/bin/App.class b/Code/Steiner/CO2-Daten-Projekt/bin/App.class index 15b3ed9..985e89e 100644 Binary files a/Code/Steiner/CO2-Daten-Projekt/bin/App.class and b/Code/Steiner/CO2-Daten-Projekt/bin/App.class differ diff --git a/Code/Steiner/CO2-Daten-Projekt/bin/Lesson.class b/Code/Steiner/CO2-Daten-Projekt/bin/Lesson.class index fd895bd..004bbc4 100644 Binary files a/Code/Steiner/CO2-Daten-Projekt/bin/Lesson.class and b/Code/Steiner/CO2-Daten-Projekt/bin/Lesson.class differ diff --git a/Code/Steiner/CO2-Daten-Projekt/src/App.java b/Code/Steiner/CO2-Daten-Projekt/src/App.java index 34e34a2..319bd88 100644 --- a/Code/Steiner/CO2-Daten-Projekt/src/App.java +++ b/Code/Steiner/CO2-Daten-Projekt/src/App.java @@ -52,8 +52,7 @@ public class App { // Maximum points for a long break: 10 points. // Plus 5 bonus points if the teachers are switching after. for (Teacher teacher : teachers) { - // Implement logic to calculate points for each teacher - teacher.setPoints(0); // Replace with actual calculation + teacher.setPoints(0); } } diff --git a/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java b/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java index fd93484..5990b7a 100644 --- a/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java +++ b/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java @@ -33,4 +33,21 @@ public class Lesson { public String getDay() { return day; } + + public boolean isBreak() { + // Logic if it is between lessons + return false; + } + + public boolean isBigBreak() { + // is the break longer than 5 minutes + // But was not the last lesson of the day + // Is not Lunch break + return false; + } + + public boolean isTeacherSwitch() { + // is a another teacher in this room + return false; + } } \ No newline at end of file