Brother Please end me

This commit is contained in:
Sage The DM 2024-10-30 16:02:50 +01:00
parent 390b59addf
commit 364fa45534
26 changed files with 378 additions and 2 deletions

View file

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

View file

@ -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).

Binary file not shown.

View file

@ -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();
}
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

View file

@ -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).

Binary file not shown.

Binary file not shown.

View file

@ -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());
}
}

View file

@ -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;
}
}

View file

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

View file

@ -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).

Binary file not shown.

Binary file not shown.

View file

@ -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;
}
}

View file

@ -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());
}
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}