help me lord

This commit is contained in:
Sage The DM 2024-11-23 21:34:00 +01:00
parent fb196693e4
commit db6b2a2a6e
42 changed files with 342 additions and 0 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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,24 @@
public class App {
public static void main(String[] args) throws Exception {
Kreis myKreis = new Kreis("blau", 10, 5, 1);
Rechteck myRechteck = new Rechteck("gelb", 0, -12, 2, 5);
System.out.println("Werte vor der modifizierung");
zeichne(myKreis, myRechteck);
System.out.println("modifikationen");
myKreis.position.bewegen(12, -11);
myRechteck.position.bewegen(33, 12);
myKreis.aendereRadius(3);
myRechteck.aendereGroesse(23, 12);
System.out.println("Werte nach der Veränderung");
zeichne(myKreis, myRechteck);
}
private static void zeichne(Kreis myKreis, Rechteck myRechteck) {
myKreis.zeichnen();
myRechteck.zeichnen();
}
}

View file

@ -0,0 +1,17 @@
public abstract class Form {
protected String farbe;
protected Position position;
public Form(String farbe, int x, int y) {
this.farbe = farbe;
Position tempPosition = new Position(x, y);
this.position = tempPosition;
}
public Position getPosition() {
return position;
}
protected abstract void zeichnen();
}

View file

@ -0,0 +1,18 @@
public class Kreis extends Form {
private int radius;
public Kreis(String farbe, int x, int y, int radius) {
super(farbe, x, y);
this.radius = radius;
}
public void aendereRadius(int myInt) {
this.radius += myInt;
}
@Override
public void zeichnen() {
System.out.println("Zeichne Kreis an der Position (" + getPosition().getX() + ", " + getPosition().getY()
+ ") mit dem radius " + radius);
}
}

View file

@ -0,0 +1,30 @@
public class Position {
int x;
int y;
Position(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public void bewegen(int x, int y) {
setX(x);
setY(y);
}
}

View file

@ -0,0 +1,21 @@
public class Rechteck extends Form {
private int hoehe;
private int breite;
public Rechteck(String farbe, int x, int y, int hoehe, int breite) {
super(farbe, x, y);
this.hoehe = hoehe;
this.breite = breite;
}
public void aendereGroesse(int hoehe, int breite) {
this.hoehe = hoehe;
this.breite = breite;
}
@Override
public void zeichnen() {
System.out.println("Zeichne ein Rechteck an der Position (" + getPosition().getX() + ", " + getPosition().getY()
+ ") mit der Breite " + breite + " und der Höhe " + hoehe);
}
}