diff --git a/Code/Steiner/JavaOldCode/src/Testcode.java b/Code/Steiner/JavaOldCode/src/Testcode.java index cfca6b9..7a532fb 100644 --- a/Code/Steiner/JavaOldCode/src/Testcode.java +++ b/Code/Steiner/JavaOldCode/src/Testcode.java @@ -1,5 +1,5 @@ public class Testcode { public static void main(String[] args) { - System.out.println("I LOVE C POINTERS --Patrick"); + } } diff --git a/Code/Steiner/dynamicCasting/.vscode/settings.json b/Code/Steiner/dynamicCasting/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/dynamicCasting/.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/dynamicCasting/README.md b/Code/Steiner/dynamicCasting/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/dynamicCasting/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/dynamicCasting/bin/App.class b/Code/Steiner/dynamicCasting/bin/App.class new file mode 100644 index 0000000..1d161fe Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/App.class differ diff --git a/Code/Steiner/dynamicCasting/bin/Article.class b/Code/Steiner/dynamicCasting/bin/Article.class new file mode 100644 index 0000000..efbe688 Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/Article.class differ diff --git a/Code/Steiner/dynamicCasting/bin/Audio.class b/Code/Steiner/dynamicCasting/bin/Audio.class new file mode 100644 index 0000000..98f6491 Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/Audio.class differ diff --git a/Code/Steiner/dynamicCasting/bin/Book.class b/Code/Steiner/dynamicCasting/bin/Book.class new file mode 100644 index 0000000..2dfa42d Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/Book.class differ diff --git a/Code/Steiner/dynamicCasting/bin/CD.class b/Code/Steiner/dynamicCasting/bin/CD.class new file mode 100644 index 0000000..3c0cd86 Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/CD.class differ diff --git a/Code/Steiner/dynamicCasting/bin/Camera.class b/Code/Steiner/dynamicCasting/bin/Camera.class new file mode 100644 index 0000000..ef7218e Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/Camera.class differ diff --git a/Code/Steiner/dynamicCasting/bin/MP3.class b/Code/Steiner/dynamicCasting/bin/MP3.class new file mode 100644 index 0000000..437c063 Binary files /dev/null and b/Code/Steiner/dynamicCasting/bin/MP3.class differ diff --git a/Code/Steiner/dynamicCasting/src/App.java b/Code/Steiner/dynamicCasting/src/App.java new file mode 100644 index 0000000..8425146 --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/App.java @@ -0,0 +1,21 @@ +import java.util.ArrayList; +import java.util.Arrays; + +public class App { + public static void main(String[] args) throws Exception { + ArrayList
list = new ArrayList
(); + list.add(new Book("11241", 12, "Tolkien", "The Book to rule all books")); + list.add(new Camera("0101012", 25000, "Fujifilm")); + list.add(new CD("0345678", 56789, "hello", + new ArrayList(Arrays.asList("Hello", "World", "THIS IS THE END")))); + list.add(new MP3("RASPUTIN", 456789, "Rasputin", "lengh")); + + for (Article article : list) { + article.print(); + if (article instanceof CD) { + ((CD) article).playTrack(); + } + System.out.println(); + } + } +} diff --git a/Code/Steiner/dynamicCasting/src/Article.java b/Code/Steiner/dynamicCasting/src/Article.java new file mode 100644 index 0000000..a608e1a --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/Article.java @@ -0,0 +1,16 @@ +public abstract class Article { + String code; + double price; + + public Article(String code, double price) { + this.code = code; + this.price = price; + } + + boolean available() { + boolean maybe = true; + return maybe; + } + + abstract void print(); +} diff --git a/Code/Steiner/dynamicCasting/src/Audio.java b/Code/Steiner/dynamicCasting/src/Audio.java new file mode 100644 index 0000000..a6e9125 --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/Audio.java @@ -0,0 +1,11 @@ +public abstract class Audio extends Article { + String title; + + public Audio(String code, double price, String title) { + super(code, price); + this.title = title; + } + + abstract void print(); + +} diff --git a/Code/Steiner/dynamicCasting/src/Book.java b/Code/Steiner/dynamicCasting/src/Book.java new file mode 100644 index 0000000..848e649 --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/Book.java @@ -0,0 +1,16 @@ +public class Book extends Article { + String author; + String title; + + public Book(String code, double price, String author, String title) { + super(code, price); + this.author = author; + this.title = title; + } + + @Override + void print() { + System.out.println(this.author + " - " + this.title); + System.out.println("Code: " + super.code + "\nPrice: " + super.price); + } +} diff --git a/Code/Steiner/dynamicCasting/src/CD.java b/Code/Steiner/dynamicCasting/src/CD.java new file mode 100644 index 0000000..45bfc33 --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/CD.java @@ -0,0 +1,27 @@ +import java.util.ArrayList; + +public class CD extends Audio { + ArrayList tracks = new ArrayList<>(); + + public CD(String code, double price, String title, ArrayList tracks) { + super(code, price, title); + this.tracks = tracks; + } + + @Override + void print() { + System.out.println("Title: " + title); + System.out.println("Code: " + super.code + "\nPrice: " + super.price); + for (String string : tracks) { + System.out.println(string); + } + } + + void playTrack() { + int i = 1; + for (String string : tracks) { + System.out.println("Play track " + i + " " + string + " der CD " + title); + i++; + } + } +} diff --git a/Code/Steiner/dynamicCasting/src/Camera.java b/Code/Steiner/dynamicCasting/src/Camera.java new file mode 100644 index 0000000..fbae850 --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/Camera.java @@ -0,0 +1,14 @@ +public class Camera extends Article { + String brand; + + public Camera(String code, double price, String brand) { + super(code, price); + this.brand = brand; + } + + @Override + void print() { + System.out.println("Brand: " + this.brand); + System.out.println("Code: " + super.code + "\nPrice: " + super.price); + } +} diff --git a/Code/Steiner/dynamicCasting/src/MP3.java b/Code/Steiner/dynamicCasting/src/MP3.java new file mode 100644 index 0000000..1064848 --- /dev/null +++ b/Code/Steiner/dynamicCasting/src/MP3.java @@ -0,0 +1,15 @@ +public class MP3 extends Audio { + String lengh; + + public MP3(String code, double price, String title, String lengh) { + super(code, price, title); + this.lengh = lengh; + } + + @Override + void print() { + System.out.println("Title: " + title); + System.out.println("Code: " + super.code + "\nPrice: " + super.price); + System.out.println("Lengh: " + lengh + " (this was not my typo i was forced to do this)"); + } +} diff --git a/Code/Steiner/gameWithCards/.vscode/settings.json b/Code/Steiner/gameWithCards/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/gameWithCards/.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/gameWithCards/README.md b/Code/Steiner/gameWithCards/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/gameWithCards/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/gameWithCards/bin/App.class b/Code/Steiner/gameWithCards/bin/App.class new file mode 100644 index 0000000..dae8c59 Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/App.class differ diff --git a/Code/Steiner/gameWithCards/bin/Board.class b/Code/Steiner/gameWithCards/bin/Board.class new file mode 100644 index 0000000..5f3ad4a Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/Board.class differ diff --git a/Code/Steiner/gameWithCards/bin/Card.class b/Code/Steiner/gameWithCards/bin/Card.class new file mode 100644 index 0000000..4e84020 Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/Card.class differ diff --git a/Code/Steiner/gameWithCards/bin/Field.class b/Code/Steiner/gameWithCards/bin/Field.class new file mode 100644 index 0000000..d8a9cb3 Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/Field.class differ diff --git a/Code/Steiner/gameWithCards/bin/Game.class b/Code/Steiner/gameWithCards/bin/Game.class new file mode 100644 index 0000000..e8eca0d Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/Game.class differ diff --git a/Code/Steiner/gameWithCards/bin/Magic.class b/Code/Steiner/gameWithCards/bin/Magic.class new file mode 100644 index 0000000..cfb97d8 Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/Magic.class differ diff --git a/Code/Steiner/gameWithCards/bin/Unit.class b/Code/Steiner/gameWithCards/bin/Unit.class new file mode 100644 index 0000000..bde39f8 Binary files /dev/null and b/Code/Steiner/gameWithCards/bin/Unit.class differ diff --git a/Code/Steiner/gameWithCards/src/App.java b/Code/Steiner/gameWithCards/src/App.java new file mode 100644 index 0000000..0230199 --- /dev/null +++ b/Code/Steiner/gameWithCards/src/App.java @@ -0,0 +1,6 @@ +public class App { + public static void main(String[] args) { + Game game = new Game(); + game.start(); + } +} \ No newline at end of file diff --git a/Code/Steiner/gameWithCards/src/Board.java b/Code/Steiner/gameWithCards/src/Board.java new file mode 100644 index 0000000..1be5f29 --- /dev/null +++ b/Code/Steiner/gameWithCards/src/Board.java @@ -0,0 +1,43 @@ +public class Board { + private int gridSize; + private Field[][] grid; + + public Board(int gridSize) { + this.gridSize = gridSize; + grid = new Field[gridSize][gridSize]; + for (int i = 0; i < gridSize; i++) { + for (int j = 0; j < gridSize; j++) { + grid[i][j] = new Field(); + } + } + } + + public void placeUnit(int x, int y) { + if (!grid[x][y].isFieldOccupied()) { + grid[x][y].setFieldOccupied(true); + System.out.println("Unit placed at (" + x + ", " + y + ")"); + } else { + System.out.println("Field is already occupied."); + } + } + + public void moveUnit(int fromX, int fromY, int toX, int toY) { + if (grid[fromX][fromY].isFieldOccupied() && !grid[toX][toY].isFieldOccupied()) { + grid[fromX][fromY].setFieldOccupied(false); + grid[toX][toY].setFieldOccupied(true); + System.out.println("Unit moved to (" + toX + ", " + toY + ")"); + } else { + System.out.println("Invalid move."); + } + } + + public boolean isWon() { + // Example condition: if any unit reaches the last row + for (int j = 0; j < gridSize; j++) { + if (grid[gridSize - 1][j].isFieldOccupied()) { + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/Code/Steiner/gameWithCards/src/Card.java b/Code/Steiner/gameWithCards/src/Card.java new file mode 100644 index 0000000..0f5d1b5 --- /dev/null +++ b/Code/Steiner/gameWithCards/src/Card.java @@ -0,0 +1,19 @@ +public abstract class Card { + private String cardName; + private String cardDescription; + + public Card(String cardName, String cardDescription) { + this.cardName = cardName; + this.cardDescription = cardDescription; + } + + public String getCardName() { + return cardName; + } + + public String getCardDescription() { + return cardDescription; + } + + public abstract void activate(); +} \ No newline at end of file diff --git a/Code/Steiner/gameWithCards/src/Field.java b/Code/Steiner/gameWithCards/src/Field.java new file mode 100644 index 0000000..7231a59 --- /dev/null +++ b/Code/Steiner/gameWithCards/src/Field.java @@ -0,0 +1,19 @@ +public class Field { + boolean isFieldOccupied; + + public Field() { + this.isFieldOccupied = false; + } + + public Field(boolean isFieldOccupied) { + this.isFieldOccupied = isFieldOccupied; + } + + public boolean isFieldOccupied() { + return isFieldOccupied; + } + + public void setFieldOccupied(boolean isFieldOccupied) { + this.isFieldOccupied = isFieldOccupied; + } +} diff --git a/Code/Steiner/gameWithCards/src/Game.java b/Code/Steiner/gameWithCards/src/Game.java new file mode 100644 index 0000000..b1ebc6b --- /dev/null +++ b/Code/Steiner/gameWithCards/src/Game.java @@ -0,0 +1,16 @@ +public class Game { + private Board board; + + public Game() { + board = new Board(5); // Example grid size + } + + public void start() { + // Example game loop + if (board.isWon()) { + System.out.println("You win!"); + } else { + System.out.println("Game continues."); + } + } +} \ No newline at end of file diff --git a/Code/Steiner/gameWithCards/src/Magic.java b/Code/Steiner/gameWithCards/src/Magic.java new file mode 100644 index 0000000..e39a531 --- /dev/null +++ b/Code/Steiner/gameWithCards/src/Magic.java @@ -0,0 +1,15 @@ +public abstract class Magic extends Card { + private int cost; + + public Magic(String cardName, String cardDescription, int cost) { + super(cardName, cardDescription); + this.cost = cost; + } + + public int getCost() { + return cost; + } + + @Override + public abstract void activate(); +} \ No newline at end of file diff --git a/Code/Steiner/gameWithCards/src/Unit.java b/Code/Steiner/gameWithCards/src/Unit.java new file mode 100644 index 0000000..ad112c1 --- /dev/null +++ b/Code/Steiner/gameWithCards/src/Unit.java @@ -0,0 +1,17 @@ +public abstract class Unit { + protected int health; + protected int defense; + protected int attack; + + public Unit(int health, int defense, int attack) { + this.health = health; + this.defense = defense; + this.attack = attack; + } + + public abstract void defend(); + + public abstract void attack(); + + public abstract void move(); +} \ No newline at end of file diff --git a/Code/Steiner/interfacesTheorie/.vscode/settings.json b/Code/Steiner/interfacesTheorie/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/interfacesTheorie/.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/interfacesTheorie/README.md b/Code/Steiner/interfacesTheorie/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/interfacesTheorie/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/interfacesTheorie/bin/App.class b/Code/Steiner/interfacesTheorie/bin/App.class new file mode 100644 index 0000000..bca8444 Binary files /dev/null and b/Code/Steiner/interfacesTheorie/bin/App.class differ diff --git a/Code/Steiner/interfacesTheorie/bin/ITierBewegen.class b/Code/Steiner/interfacesTheorie/bin/ITierBewegen.class new file mode 100644 index 0000000..55793a4 Binary files /dev/null and b/Code/Steiner/interfacesTheorie/bin/ITierBewegen.class differ diff --git a/Code/Steiner/interfacesTheorie/bin/ITierNahrungsaufnahme.class b/Code/Steiner/interfacesTheorie/bin/ITierNahrungsaufnahme.class new file mode 100644 index 0000000..def04ce Binary files /dev/null and b/Code/Steiner/interfacesTheorie/bin/ITierNahrungsaufnahme.class differ diff --git a/Code/Steiner/interfacesTheorie/bin/Kuckuck.class b/Code/Steiner/interfacesTheorie/bin/Kuckuck.class new file mode 100644 index 0000000..d29b882 Binary files /dev/null and b/Code/Steiner/interfacesTheorie/bin/Kuckuck.class differ diff --git a/Code/Steiner/interfacesTheorie/bin/Vogel.class b/Code/Steiner/interfacesTheorie/bin/Vogel.class new file mode 100644 index 0000000..32f3cc6 Binary files /dev/null and b/Code/Steiner/interfacesTheorie/bin/Vogel.class differ diff --git a/Code/Steiner/interfacesTheorie/src/App.java b/Code/Steiner/interfacesTheorie/src/App.java new file mode 100644 index 0000000..c28671a --- /dev/null +++ b/Code/Steiner/interfacesTheorie/src/App.java @@ -0,0 +1,8 @@ +public class App { + public static void main(String[] args) throws Exception { + Kuckuck fips = new Kuckuck(); + fips.singen(); + fips.bewegen(); + fips.essen(); + } +} diff --git a/Code/Steiner/interfacesTheorie/src/ITierBewegen.java b/Code/Steiner/interfacesTheorie/src/ITierBewegen.java new file mode 100644 index 0000000..45cb5c5 --- /dev/null +++ b/Code/Steiner/interfacesTheorie/src/ITierBewegen.java @@ -0,0 +1,3 @@ +public interface ITierBewegen { + public void bewegen(); +} \ No newline at end of file diff --git a/Code/Steiner/interfacesTheorie/src/ITierNahrungsaufnahme.java b/Code/Steiner/interfacesTheorie/src/ITierNahrungsaufnahme.java new file mode 100644 index 0000000..33916c3 --- /dev/null +++ b/Code/Steiner/interfacesTheorie/src/ITierNahrungsaufnahme.java @@ -0,0 +1,4 @@ +public interface ITierNahrungsaufnahme { + public void essen(); + +} diff --git a/Code/Steiner/interfacesTheorie/src/Kuckuck.java b/Code/Steiner/interfacesTheorie/src/Kuckuck.java new file mode 100644 index 0000000..71b5e60 --- /dev/null +++ b/Code/Steiner/interfacesTheorie/src/Kuckuck.java @@ -0,0 +1,17 @@ +public class Kuckuck extends Vogel { + + @Override + public void singen() { + System.out.println("Kuckuck geräusche"); + } + + @Override + public void essen() { + System.out.println("Der Kuckuck fliegt"); + } + + @Override + public void bewegen() { + System.out.println("Der Kuckuck frisst mücken - MAHLZEIT"); + } +} diff --git a/Code/Steiner/interfacesTheorie/src/Vogel.java b/Code/Steiner/interfacesTheorie/src/Vogel.java new file mode 100644 index 0000000..d35098f --- /dev/null +++ b/Code/Steiner/interfacesTheorie/src/Vogel.java @@ -0,0 +1,7 @@ +public abstract class Vogel implements ITierNahrungsaufnahme, ITierBewegen { + Vogel() { + + } + + public abstract void singen(); +} \ No newline at end of file diff --git a/Code/Steiner/pruefung04-12-24(2)/.vscode/settings.json b/Code/Steiner/pruefung04-12-24(2)/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/pruefung04-12-24(2)/.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/pruefung04-12-24(2)/README.md b/Code/Steiner/pruefung04-12-24(2)/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/pruefung04-12-24(2)/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/pruefung04-12-24(2)/bin/App.class b/Code/Steiner/pruefung04-12-24(2)/bin/App.class new file mode 100644 index 0000000..6f595cd Binary files /dev/null and b/Code/Steiner/pruefung04-12-24(2)/bin/App.class differ diff --git a/Code/Steiner/pruefung04-12-24(2)/bin/LabeledRectangle.class b/Code/Steiner/pruefung04-12-24(2)/bin/LabeledRectangle.class new file mode 100644 index 0000000..3fb044c Binary files /dev/null and b/Code/Steiner/pruefung04-12-24(2)/bin/LabeledRectangle.class differ diff --git a/Code/Steiner/pruefung04-12-24(2)/src/App.class b/Code/Steiner/pruefung04-12-24(2)/src/App.class new file mode 100644 index 0000000..f362369 Binary files /dev/null and b/Code/Steiner/pruefung04-12-24(2)/src/App.class differ diff --git a/Code/Steiner/pruefung04-12-24(2)/src/App.java b/Code/Steiner/pruefung04-12-24(2)/src/App.java new file mode 100644 index 0000000..a1f875b --- /dev/null +++ b/Code/Steiner/pruefung04-12-24(2)/src/App.java @@ -0,0 +1,27 @@ +//Luca Fbian Burger +// Aufgabe 5 + +public class App { + public static void main(String[] args) throws Exception { + // Erstelle ein beschriftetes Rechteck + LabeledRectangle rect = new LabeledRectangle(10, 20, 100, 50, "Mein Rechteck"); + + // Informationen übder das Rechteck asugeben + System.out.println("Rechteck-Informationen"); + System.out.println(rect.getInfo()); + + // Grenzen des Rechtecks verschieben und ändern + System.out.println("\nÄndere die Grenzen des Rechtecks..."); + rect.setBounds(50, 60, 200, 100); + + // Prüfen ob ein Punkt innerhalb des Rechtecks liegt + int testX = 130; + int testY = 140; + System.out.println("\nPrüfe ob Punkt (" + testX + ", " + testY + ") im Rechteck liegt:"); + if (rect.contains(testX, testY)) { + System.out.println("Der Punkt liegt im Rechteck."); + } else { + System.out.println("Der Punkt liegt ausserhalb des Rechtecks."); + } + } +} diff --git a/Code/Steiner/pruefung04-12-24(2)/src/LabeledRectangle.class b/Code/Steiner/pruefung04-12-24(2)/src/LabeledRectangle.class new file mode 100644 index 0000000..df8afa0 Binary files /dev/null and b/Code/Steiner/pruefung04-12-24(2)/src/LabeledRectangle.class differ diff --git a/Code/Steiner/pruefung04-12-24(2)/src/LabeledRectangle.java b/Code/Steiner/pruefung04-12-24(2)/src/LabeledRectangle.java new file mode 100644 index 0000000..b578316 --- /dev/null +++ b/Code/Steiner/pruefung04-12-24(2)/src/LabeledRectangle.java @@ -0,0 +1,18 @@ +//Luca Fbian Burger +// Aufgabe 5 + +import java.awt.Rectangle; + +public class LabeledRectangle extends Rectangle { + private String label; + + LabeledRectangle(int x, int y, int width, int height, String label) { + super(x, y, width, height); + this.label = label; + } + + public String getInfo() { + return "Label: " + this.label + "\nPosition: (" + this.x + ", " + this.y + ")" + "\nGrösse: " + this.width + "x" + + this.height; + } +} diff --git a/Code/Steiner/pruefung04-12-24/.vscode/settings.json b/Code/Steiner/pruefung04-12-24/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/pruefung04-12-24/.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/pruefung04-12-24/README.md b/Code/Steiner/pruefung04-12-24/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/pruefung04-12-24/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/pruefung04-12-24/bin/App.class b/Code/Steiner/pruefung04-12-24/bin/App.class new file mode 100644 index 0000000..e22e395 Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/bin/App.class differ diff --git a/Code/Steiner/pruefung04-12-24/bin/DatenanalysePlugin.class b/Code/Steiner/pruefung04-12-24/bin/DatenanalysePlugin.class new file mode 100644 index 0000000..4f5ae2b Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/bin/DatenanalysePlugin.class differ diff --git a/Code/Steiner/pruefung04-12-24/bin/Plugin.class b/Code/Steiner/pruefung04-12-24/bin/Plugin.class new file mode 100644 index 0000000..95f75ce Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/bin/Plugin.class differ diff --git a/Code/Steiner/pruefung04-12-24/bin/UIPlugin.class b/Code/Steiner/pruefung04-12-24/bin/UIPlugin.class new file mode 100644 index 0000000..f99fc62 Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/bin/UIPlugin.class differ diff --git a/Code/Steiner/pruefung04-12-24/src/App.class b/Code/Steiner/pruefung04-12-24/src/App.class new file mode 100644 index 0000000..c77e64a Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/src/App.class differ diff --git a/Code/Steiner/pruefung04-12-24/src/App.java b/Code/Steiner/pruefung04-12-24/src/App.java new file mode 100644 index 0000000..0f70c9b --- /dev/null +++ b/Code/Steiner/pruefung04-12-24/src/App.java @@ -0,0 +1,17 @@ +// Luca Fbaian Burger +// Aufgabe 4 + +public class App { + public static void main(String[] args) throws Exception { + DatenanalysePlugin data = new DatenanalysePlugin("DataAnalyzer", "1.0", "Kundendaten"); + UIPlugin ui = new UIPlugin("FancyUI", "1.1", "Buttons and slider"); + + data.installieren(); + data.hinzufuegenDatenquelle("Einkausdaten"); + data.ausfuehren(); + ui.installieren(); + ui.ausfuehren(); + ui.anpassen("Graphen und Digramme"); + ui.ausfuehren(); + } +} diff --git a/Code/Steiner/pruefung04-12-24/src/DatenanalysePlugin.class b/Code/Steiner/pruefung04-12-24/src/DatenanalysePlugin.class new file mode 100644 index 0000000..8b81eaa Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/src/DatenanalysePlugin.class differ diff --git a/Code/Steiner/pruefung04-12-24/src/DatenanalysePlugin.java b/Code/Steiner/pruefung04-12-24/src/DatenanalysePlugin.java new file mode 100644 index 0000000..f6b7276 --- /dev/null +++ b/Code/Steiner/pruefung04-12-24/src/DatenanalysePlugin.java @@ -0,0 +1,24 @@ +// Luca Fbaian Burger +// Aufgabe 5 + +import java.util.ArrayList; + +public class DatenanalysePlugin extends Plugin { + private ArrayList datenquellen = new ArrayList(); + + public DatenanalysePlugin(String name, String version, String datenquelle) { + super(name, version); + datenquellen.add(datenquelle); + } + + public void ausfuehren() { + for (String string : datenquellen) { + System.out.println("Datenanalyse für " + string + " wird durchgeführt."); + } + } + + public void hinzufuegenDatenquelle(String neueDatenquelle) { + datenquellen.add(neueDatenquelle); + System.out.println("Datenquelle hinzugefügt: " + neueDatenquelle); + } +} diff --git a/Code/Steiner/pruefung04-12-24/src/Plugin.class b/Code/Steiner/pruefung04-12-24/src/Plugin.class new file mode 100644 index 0000000..39f2b5a Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/src/Plugin.class differ diff --git a/Code/Steiner/pruefung04-12-24/src/Plugin.java b/Code/Steiner/pruefung04-12-24/src/Plugin.java new file mode 100644 index 0000000..65f58af --- /dev/null +++ b/Code/Steiner/pruefung04-12-24/src/Plugin.java @@ -0,0 +1,31 @@ +// Luca Fbaian Burger +// Aufgabe 5 + +public abstract class Plugin { + protected String name; + protected String version; + + public Plugin(String name, String version) { + this.name = name; + this.version = version; + } + + public String getName() { + return name; + } + + public String getVersion() { + return version; + } + + public void installieren() { + System.out.println(this.name + " Version " + version + " wird installiert."); + } + + public void deinstallieren() { + // Logik + } + + public abstract void ausfuehren(); + +} diff --git a/Code/Steiner/pruefung04-12-24/src/UIPlugin.class b/Code/Steiner/pruefung04-12-24/src/UIPlugin.class new file mode 100644 index 0000000..b09172f Binary files /dev/null and b/Code/Steiner/pruefung04-12-24/src/UIPlugin.class differ diff --git a/Code/Steiner/pruefung04-12-24/src/UIPlugin.java b/Code/Steiner/pruefung04-12-24/src/UIPlugin.java new file mode 100644 index 0000000..de1df4f --- /dev/null +++ b/Code/Steiner/pruefung04-12-24/src/UIPlugin.java @@ -0,0 +1,20 @@ +// Luca Fbaian Burger +// Aufgabe 5 + +public class UIPlugin extends Plugin { + private String uiElement; + + public UIPlugin(String name, String version, String uiElement) { + super(name, version); + this.uiElement = uiElement; + } + + public void ausfuehren() { + System.out.println("UI Erweiterung wird ausgeführt: " + this.uiElement); + } + + public void anpassen(String uiElement) { + this.uiElement = uiElement; + System.out.println("UI angepasst zu: " + this.uiElement); + } +} diff --git a/Code/Steiner/samsung(Interfaces-task)/.vscode/settings.json b/Code/Steiner/samsung(Interfaces-task)/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/.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/samsung(Interfaces-task)/README.md b/Code/Steiner/samsung(Interfaces-task)/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/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/samsung(Interfaces-task)/bin/App.class b/Code/Steiner/samsung(Interfaces-task)/bin/App.class new file mode 100644 index 0000000..a4a8aa5 Binary files /dev/null and b/Code/Steiner/samsung(Interfaces-task)/bin/App.class differ diff --git a/Code/Steiner/samsung(Interfaces-task)/bin/GalaxyJ3.class b/Code/Steiner/samsung(Interfaces-task)/bin/GalaxyJ3.class new file mode 100644 index 0000000..2e91b50 Binary files /dev/null and b/Code/Steiner/samsung(Interfaces-task)/bin/GalaxyJ3.class differ diff --git a/Code/Steiner/samsung(Interfaces-task)/bin/GalaxyS5.class b/Code/Steiner/samsung(Interfaces-task)/bin/GalaxyS5.class new file mode 100644 index 0000000..7b73a98 Binary files /dev/null and b/Code/Steiner/samsung(Interfaces-task)/bin/GalaxyS5.class differ diff --git a/Code/Steiner/samsung(Interfaces-task)/bin/ITelefon.class b/Code/Steiner/samsung(Interfaces-task)/bin/ITelefon.class new file mode 100644 index 0000000..e5a3d8b Binary files /dev/null and b/Code/Steiner/samsung(Interfaces-task)/bin/ITelefon.class differ diff --git a/Code/Steiner/samsung(Interfaces-task)/bin/Samsung.class b/Code/Steiner/samsung(Interfaces-task)/bin/Samsung.class new file mode 100644 index 0000000..a6a8e92 Binary files /dev/null and b/Code/Steiner/samsung(Interfaces-task)/bin/Samsung.class differ diff --git a/Code/Steiner/samsung(Interfaces-task)/src/App.java b/Code/Steiner/samsung(Interfaces-task)/src/App.java new file mode 100644 index 0000000..07bf631 --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/src/App.java @@ -0,0 +1,24 @@ +import java.util.ArrayList; + +public class App { + public static void main(String[] args) throws Exception { + ArrayList devices = new ArrayList(); + devices.add(new GalaxyJ3(11.85, "Phone")); + devices.add(new GalaxyS5(12.45, "phone", "sunset-black")); + + for (Samsung samsung : devices) { + System.out.println(samsung.preis); + System.out.println(samsung.produktTyp); + if (samsung instanceof GalaxyS5) { + System.out.println(((GalaxyS5) samsung).farbe); + } + System.out.println("Funktionstest"); + if (samsung instanceof ITelefon) { + ((ITelefon) samsung).powerOn(); + ((ITelefon) samsung).esKlingelt(); + ((ITelefon) samsung).anrufen(); + } + System.out.println(); + } + } +} diff --git a/Code/Steiner/samsung(Interfaces-task)/src/GalaxyJ3.java b/Code/Steiner/samsung(Interfaces-task)/src/GalaxyJ3.java new file mode 100644 index 0000000..f2623e5 --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/src/GalaxyJ3.java @@ -0,0 +1,22 @@ +public class GalaxyJ3 extends Samsung implements ITelefon { + + public GalaxyJ3(double preis, String produktTyp) { + super(preis, produktTyp); + } + + @Override + public void powerOn() { + System.out.println("GalaxyJ3 is starting"); + } + + @Override + public void esKlingelt() { + System.out.println("DING DING DING"); + } + + @Override + public void anrufen() { + System.out.println("No one will pick up - since you have no signal in the basement"); + } + +} diff --git a/Code/Steiner/samsung(Interfaces-task)/src/GalaxyS5.java b/Code/Steiner/samsung(Interfaces-task)/src/GalaxyS5.java new file mode 100644 index 0000000..70fc66a --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/src/GalaxyS5.java @@ -0,0 +1,23 @@ +public class GalaxyS5 extends Samsung implements ITelefon { + String farbe; + + public GalaxyS5(double preis, String produktTyp, String farbe) { + super(preis, produktTyp); + this.farbe = farbe; + } + + @Override + public void powerOn() { + System.out.println("GalaxyJ5 is starting"); + } + + @Override + public void esKlingelt() { + System.out.println("DING DING DING"); + } + + @Override + public void anrufen() { + System.out.println("No one will pick up - since you have no signal in the basement"); + } +} diff --git a/Code/Steiner/samsung(Interfaces-task)/src/ITelefon.java b/Code/Steiner/samsung(Interfaces-task)/src/ITelefon.java new file mode 100644 index 0000000..fe979d9 --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/src/ITelefon.java @@ -0,0 +1,7 @@ +public interface ITelefon { + public void powerOn(); + + public void esKlingelt(); + + public void anrufen(); +} diff --git a/Code/Steiner/samsung(Interfaces-task)/src/Samsung.java b/Code/Steiner/samsung(Interfaces-task)/src/Samsung.java new file mode 100644 index 0000000..5a15e61 --- /dev/null +++ b/Code/Steiner/samsung(Interfaces-task)/src/Samsung.java @@ -0,0 +1,9 @@ +public abstract class Samsung { + double preis; + String produktTyp; + + public Samsung(double preis, String produktTyp) { + this.preis = preis; + this.produktTyp = produktTyp; + } +} diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/pom.xml b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/pom.xml new file mode 100644 index 0000000..0ecad96 --- /dev/null +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + com.example + _javafx_website_task + 1.0-SNAPSHOT + + UTF-8 + 11 + 11 + + + + org.openjfx + javafx-controls + 13 + + + org.openjfx + javafx-fxml + 13 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + + default-cli + + com.example.App + + + + + + + diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java new file mode 100644 index 0000000..0a8c8fe --- /dev/null +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/App.java @@ -0,0 +1,38 @@ +package com.example; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +/** + * JavaFX App + */ +public class App extends Application { + + private static Scene scene; + + @Override + public void start(Stage stage) throws IOException { + scene = new Scene(loadFXML("shop"), 640, 480); + stage.setScene(scene); + stage.show(); + } + + static void setRoot(String fxml) throws IOException { + scene.setRoot(loadFXML(fxml)); + } + + private static Parent loadFXML(String fxml) throws IOException { + FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml")); + return fxmlLoader.load(); + } + + public static void main(String[] args) { + launch(); + } + +} \ No newline at end of file diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/PrimaryController.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/PrimaryController.java new file mode 100644 index 0000000..b058b06 --- /dev/null +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/PrimaryController.java @@ -0,0 +1,77 @@ +package com.example; + +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.scene.control.ListCell; +import javafx.scene.control.ListView; +import javafx.scene.layout.HBox; +import javafx.scene.text.Text; + +public class PrimaryController { + + @FXML + private ListView cartList; + + @FXML + public void initialize() { + // Sample data + ObservableList items = FXCollections.observableArrayList( + new Item("Book 1", "Fantasy adventure novel", 3, 19.99), + new Item("Book 2", "Science fiction thriller", 1, 25.50)); + + cartList.setItems(items); + + // Custom cell factory to display items + cartList.setCellFactory(param -> new ListCell() { + @Override + protected void updateItem(Item item, boolean empty) { + super.updateItem(item, empty); + if (empty || item == null) { + setText(null); + } else { + // Create a custom layout for each item + HBox hbox = new HBox(); + Text titleText = new Text(item.getTitle()); + Text descText = new Text(item.getDescription()); + Text quantityText = new Text("Quantity: " + item.getQuantity()); + Text priceText = new Text("Price: $" + item.getPrice()); + + hbox.getChildren().addAll(titleText, descText, quantityText, priceText); + setGraphic(hbox); + } + } + }); + } + + // Item class to hold data + public static class Item { + private String title; + private String description; + private int quantity; + private double price; + + public Item(String title, String description, int quantity, double price) { + this.title = title; + this.description = description; + this.quantity = quantity; + this.price = price; + } + + public String getTitle() { + return title; + } + + public String getDescription() { + return description; + } + + public int getQuantity() { + return quantity; + } + + public double getPrice() { + return price; + } + } +} diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/SecondaryController.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/SecondaryController.java new file mode 100644 index 0000000..4cbf23d --- /dev/null +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/com/example/SecondaryController.java @@ -0,0 +1,12 @@ +package com.example; + +import java.io.IOException; +import javafx.fxml.FXML; + +public class SecondaryController { + + @FXML + private void switchToPrimary() throws IOException { + App.setRoot("primary"); + } +} \ No newline at end of file diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/module-info.java b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/module-info.java new file mode 100644 index 0000000..aab90f4 --- /dev/null +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module com.example { + requires javafx.controls; + requires javafx.fxml; + + opens com.example to javafx.fxml; + exports com.example; +} diff --git a/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/cart.fxml b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/cart.fxml new file mode 100644 index 0000000..9ae8218 --- /dev/null +++ b/Code/ost/JAVA-FX-PROJECT/_javafx_website_task/src/main/resources/com/example/cart.fxml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + +