AHHHHHHHHHH COMMITED TO GITHUB INSTEAD OF FORGEJO FOR WEEKS

This commit is contained in:
sageTheDM 2024-12-16 20:32:46 +01:00
parent d6ef44f3d1
commit 0919005cb2
163 changed files with 3875 additions and 47 deletions

View file

@ -1,5 +1,5 @@
public class Testcode {
public static void main(String[] args) {
System.out.println("I LOVE C POINTERS --Patrick");
}
}

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,21 @@
import java.util.ArrayList;
import java.util.Arrays;
public class App {
public static void main(String[] args) throws Exception {
ArrayList<Article> list = new ArrayList<Article>();
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<String>(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();
}
}
}

View file

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

View file

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

View file

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

View file

@ -0,0 +1,27 @@
import java.util.ArrayList;
public class CD extends Audio {
ArrayList<String> tracks = new ArrayList<>();
public CD(String code, double price, String title, ArrayList<String> 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++;
}
}
}

View file

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

View file

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

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,6 @@
public class App {
public static void main(String[] args) {
Game game = new Game();
game.start();
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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.

Binary file not shown.

Binary file not shown.

View file

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

View file

@ -0,0 +1,3 @@
public interface ITierBewegen {
public void bewegen();
}

View file

@ -0,0 +1,4 @@
public interface ITierNahrungsaufnahme {
public void essen();
}

View file

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

View file

@ -0,0 +1,7 @@
public abstract class Vogel implements ITierNahrungsaufnahme, ITierBewegen {
Vogel() {
}
public abstract void singen();
}

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

View file

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

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.

Binary file not shown.

Binary file not shown.

View file

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

View file

@ -0,0 +1,24 @@
// Luca Fbaian Burger
// Aufgabe 5
import java.util.ArrayList;
public class DatenanalysePlugin extends Plugin {
private ArrayList<String> datenquellen = new ArrayList<String>();
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);
}
}

Binary file not shown.

View file

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

Binary file not shown.

View file

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

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,24 @@
import java.util.ArrayList;
public class App {
public static void main(String[] args) throws Exception {
ArrayList<Samsung> devices = new ArrayList<Samsung>();
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();
}
}
}

View file

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

View file

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

View file

@ -0,0 +1,7 @@
public interface ITelefon {
public void powerOn();
public void esKlingelt();
public void anrufen();
}

View file

@ -0,0 +1,9 @@
public abstract class Samsung {
double preis;
String produktTyp;
public Samsung(double preis, String produktTyp) {
this.preis = preis;
this.produktTyp = produktTyp;
}
}