help me lord
This commit is contained in:
parent
fb196693e4
commit
db6b2a2a6e
42 changed files with 342 additions and 0 deletions
7
Code/Steiner/abstractAufgabe/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/abstractAufgabe/.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/abstractAufgabe/README.md
Normal file
18
Code/Steiner/abstractAufgabe/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/abstractAufgabe/bin/App.class
Normal file
BIN
Code/Steiner/abstractAufgabe/bin/App.class
Normal file
Binary file not shown.
BIN
Code/Steiner/abstractAufgabe/bin/Auto.class
Normal file
BIN
Code/Steiner/abstractAufgabe/bin/Auto.class
Normal file
Binary file not shown.
BIN
Code/Steiner/abstractAufgabe/bin/Boot.class
Normal file
BIN
Code/Steiner/abstractAufgabe/bin/Boot.class
Normal file
Binary file not shown.
BIN
Code/Steiner/abstractAufgabe/bin/Fahrzeug.class
Normal file
BIN
Code/Steiner/abstractAufgabe/bin/Fahrzeug.class
Normal file
Binary file not shown.
BIN
Code/Steiner/abstractAufgabe/src/App.class
Normal file
BIN
Code/Steiner/abstractAufgabe/src/App.class
Normal file
Binary file not shown.
10
Code/Steiner/abstractAufgabe/src/App.java
Normal file
10
Code/Steiner/abstractAufgabe/src/App.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// Hauptprogramm App
|
||||||
|
public class App {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Auto auto = new Auto("Ferrari");
|
||||||
|
Boot boot = new Boot("Titanic");
|
||||||
|
|
||||||
|
auto.bewegen();
|
||||||
|
boot.bewegen();
|
||||||
|
}
|
||||||
|
}
|
BIN
Code/Steiner/abstractAufgabe/src/Auto.class
Normal file
BIN
Code/Steiner/abstractAufgabe/src/Auto.class
Normal file
Binary file not shown.
12
Code/Steiner/abstractAufgabe/src/Auto.java
Normal file
12
Code/Steiner/abstractAufgabe/src/Auto.java
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
// Klasse Auto
|
||||||
|
public class Auto extends Fahrzeug {
|
||||||
|
public Auto(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bewegen() {
|
||||||
|
System.out.println("Das Auto " + getName() + " fährt auf der Strasse.");
|
||||||
|
}
|
||||||
|
}
|
BIN
Code/Steiner/abstractAufgabe/src/Boot.class
Normal file
BIN
Code/Steiner/abstractAufgabe/src/Boot.class
Normal file
Binary file not shown.
11
Code/Steiner/abstractAufgabe/src/Boot.java
Normal file
11
Code/Steiner/abstractAufgabe/src/Boot.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
// Klasse Boot
|
||||||
|
public class Boot extends Fahrzeug {
|
||||||
|
public Boot(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bewegen() {
|
||||||
|
System.out.println("Das Boot " + getName() + " fährt auf dem Wasser.");
|
||||||
|
}
|
||||||
|
}
|
BIN
Code/Steiner/abstractAufgabe/src/Fahrzeug.class
Normal file
BIN
Code/Steiner/abstractAufgabe/src/Fahrzeug.class
Normal file
Binary file not shown.
14
Code/Steiner/abstractAufgabe/src/Fahrzeug.java
Normal file
14
Code/Steiner/abstractAufgabe/src/Fahrzeug.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Basisklasse Fahrzeug
|
||||||
|
public abstract class Fahrzeug {
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public Fahrzeug(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void bewegen();
|
||||||
|
}
|
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);
|
||||||
|
}
|
||||||
|
}
|
7
Code/Steiner/giroKonto/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/giroKonto/.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/giroKonto/README.md
Normal file
18
Code/Steiner/giroKonto/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/giroKonto/bin/App.class
Normal file
BIN
Code/Steiner/giroKonto/bin/App.class
Normal file
Binary file not shown.
BIN
Code/Steiner/giroKonto/bin/Konto.class
Normal file
BIN
Code/Steiner/giroKonto/bin/Konto.class
Normal file
Binary file not shown.
BIN
Code/Steiner/giroKonto/src/App.class
Normal file
BIN
Code/Steiner/giroKonto/src/App.class
Normal file
Binary file not shown.
16
Code/Steiner/giroKonto/src/App.java
Normal file
16
Code/Steiner/giroKonto/src/App.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
public class App {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// Aufgabe 1
|
||||||
|
System.out.println("Aufgabe 1: \n");
|
||||||
|
|
||||||
|
Konto konto1 = new Konto("0000000001", 1000);
|
||||||
|
System.out.println(konto1.toString());
|
||||||
|
konto1.einzahlen(500);
|
||||||
|
konto1.abheben(750);
|
||||||
|
System.out.println("\nDaten nach transaktionen: ");
|
||||||
|
System.out.println(konto1.toString());
|
||||||
|
|
||||||
|
// Aufgabe 2
|
||||||
|
System.out.println("Aufgabe 2");
|
||||||
|
}
|
||||||
|
}
|
BIN
Code/Steiner/giroKonto/src/Konto.class
Normal file
BIN
Code/Steiner/giroKonto/src/Konto.class
Normal file
Binary file not shown.
40
Code/Steiner/giroKonto/src/Konto.java
Normal file
40
Code/Steiner/giroKonto/src/Konto.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
public class Konto {
|
||||||
|
private String kontonummer;
|
||||||
|
private double kontostand;
|
||||||
|
|
||||||
|
public Konto(String kontonummer, int kontostand) {
|
||||||
|
if (kontonummer.length() == 10) {
|
||||||
|
this.kontonummer = kontonummer;
|
||||||
|
this.kontostand = kontostand;
|
||||||
|
} else
|
||||||
|
System.out.println("Es ist fehler beim erstellen des Konto aufgetreten");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKontonummer() {
|
||||||
|
return kontonummer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getKontostand() {
|
||||||
|
return kontostand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void abheben(double betrag) {
|
||||||
|
if (kontostand >= 0) {
|
||||||
|
this.kontostand -= betrag;
|
||||||
|
} else
|
||||||
|
System.out.println("Fehlermeldung #1225");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void einzahlen(double betrag) {
|
||||||
|
if (kontostand >= 0) {
|
||||||
|
this.kontostand += betrag;
|
||||||
|
} else
|
||||||
|
System.out.println("Fehlermeldung #5221");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Konto [Kontonummer=" + kontonummer + ", Kontostand=" + kontostand + "CHF]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
7
Code/Steiner/simpleCalender/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/simpleCalender/.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/simpleCalender/README.md
Normal file
18
Code/Steiner/simpleCalender/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/simpleCalender/bin/App.class
Normal file
BIN
Code/Steiner/simpleCalender/bin/App.class
Normal file
Binary file not shown.
BIN
Code/Steiner/simpleCalender/bin/SimpleCalendar.class
Normal file
BIN
Code/Steiner/simpleCalender/bin/SimpleCalendar.class
Normal file
Binary file not shown.
BIN
Code/Steiner/simpleCalender/src/App.class
Normal file
BIN
Code/Steiner/simpleCalender/src/App.class
Normal file
Binary file not shown.
14
Code/Steiner/simpleCalender/src/App.java
Normal file
14
Code/Steiner/simpleCalender/src/App.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
public class App {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
SimpleCalendar simpleCalendar = new SimpleCalendar();
|
||||||
|
// Aktuelles Datum und Uhrzeit formatieren und ausgeben
|
||||||
|
System.out.println("Aktuelles Datum und Uhrzeit:");
|
||||||
|
System.out.println(simpleCalendar.getFormattedDate());
|
||||||
|
|
||||||
|
// Zeit manipulieren
|
||||||
|
simpleCalendar.add(SimpleCalendar.DAY_OF_MONTH, 5);
|
||||||
|
System.out.println("Datum in 5 Tagen:");
|
||||||
|
System.out.println(simpleCalendar.getFormattedDate());
|
||||||
|
}
|
||||||
|
}
|
BIN
Code/Steiner/simpleCalender/src/SimpleCalendar.class
Normal file
BIN
Code/Steiner/simpleCalender/src/SimpleCalendar.class
Normal file
Binary file not shown.
15
Code/Steiner/simpleCalender/src/SimpleCalendar.java
Normal file
15
Code/Steiner/simpleCalender/src/SimpleCalendar.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
|
public class SimpleCalendar extends GregorianCalendar {
|
||||||
|
|
||||||
|
public String getFormattedDate() {
|
||||||
|
int year = get(GregorianCalendar.YEAR);
|
||||||
|
int month = get(GregorianCalendar.MONTH) + 1; // Monate sind 0-basiert
|
||||||
|
int day = get(GregorianCalendar.DAY_OF_MONTH);
|
||||||
|
int hour = get(GregorianCalendar.HOUR_OF_DAY);
|
||||||
|
int minute = get(GregorianCalendar.MINUTE);
|
||||||
|
int second = get(GregorianCalendar.SECOND);
|
||||||
|
|
||||||
|
return String.format("%02d.%02d.%04d %02d:%02d:%02d", day, month, year, hour, minute, second);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue