help me lord
This commit is contained in:
parent
fb196693e4
commit
db6b2a2a6e
42 changed files with 342 additions and 0 deletions
7
Code/Steiner/geometryAbstarct/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/geometryAbstarct/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
18
Code/Steiner/geometryAbstarct/README.md
Normal file
18
Code/Steiner/geometryAbstarct/README.md
Normal 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).
|
BIN
Code/Steiner/geometryAbstarct/bin/App.class
Normal file
BIN
Code/Steiner/geometryAbstarct/bin/App.class
Normal file
Binary file not shown.
BIN
Code/Steiner/geometryAbstarct/bin/Form.class
Normal file
BIN
Code/Steiner/geometryAbstarct/bin/Form.class
Normal file
Binary file not shown.
BIN
Code/Steiner/geometryAbstarct/bin/Kreis.class
Normal file
BIN
Code/Steiner/geometryAbstarct/bin/Kreis.class
Normal file
Binary file not shown.
BIN
Code/Steiner/geometryAbstarct/bin/Position.class
Normal file
BIN
Code/Steiner/geometryAbstarct/bin/Position.class
Normal file
Binary file not shown.
BIN
Code/Steiner/geometryAbstarct/bin/Rechteck.class
Normal file
BIN
Code/Steiner/geometryAbstarct/bin/Rechteck.class
Normal file
Binary file not shown.
24
Code/Steiner/geometryAbstarct/src/App.java
Normal file
24
Code/Steiner/geometryAbstarct/src/App.java
Normal 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();
|
||||
}
|
||||
}
|
17
Code/Steiner/geometryAbstarct/src/Form.java
Normal file
17
Code/Steiner/geometryAbstarct/src/Form.java
Normal 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();
|
||||
}
|
18
Code/Steiner/geometryAbstarct/src/Kreis.java
Normal file
18
Code/Steiner/geometryAbstarct/src/Kreis.java
Normal 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);
|
||||
}
|
||||
}
|
30
Code/Steiner/geometryAbstarct/src/Position.java
Normal file
30
Code/Steiner/geometryAbstarct/src/Position.java
Normal 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);
|
||||
}
|
||||
}
|
21
Code/Steiner/geometryAbstarct/src/Rechteck.java
Normal file
21
Code/Steiner/geometryAbstarct/src/Rechteck.java
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue