diff --git a/Code/Steiner/abstractAufgabe/.vscode/settings.json b/Code/Steiner/abstractAufgabe/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/abstractAufgabe/.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/abstractAufgabe/README.md b/Code/Steiner/abstractAufgabe/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/abstractAufgabe/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/abstractAufgabe/bin/App.class b/Code/Steiner/abstractAufgabe/bin/App.class new file mode 100644 index 0000000..b3142ed Binary files /dev/null and b/Code/Steiner/abstractAufgabe/bin/App.class differ diff --git a/Code/Steiner/abstractAufgabe/bin/Auto.class b/Code/Steiner/abstractAufgabe/bin/Auto.class new file mode 100644 index 0000000..061d845 Binary files /dev/null and b/Code/Steiner/abstractAufgabe/bin/Auto.class differ diff --git a/Code/Steiner/abstractAufgabe/bin/Boot.class b/Code/Steiner/abstractAufgabe/bin/Boot.class new file mode 100644 index 0000000..ac5a8cf Binary files /dev/null and b/Code/Steiner/abstractAufgabe/bin/Boot.class differ diff --git a/Code/Steiner/abstractAufgabe/bin/Fahrzeug.class b/Code/Steiner/abstractAufgabe/bin/Fahrzeug.class new file mode 100644 index 0000000..a1ca1fe Binary files /dev/null and b/Code/Steiner/abstractAufgabe/bin/Fahrzeug.class differ diff --git a/Code/Steiner/abstractAufgabe/src/App.class b/Code/Steiner/abstractAufgabe/src/App.class new file mode 100644 index 0000000..a51d41a Binary files /dev/null and b/Code/Steiner/abstractAufgabe/src/App.class differ diff --git a/Code/Steiner/abstractAufgabe/src/App.java b/Code/Steiner/abstractAufgabe/src/App.java new file mode 100644 index 0000000..b9da557 --- /dev/null +++ b/Code/Steiner/abstractAufgabe/src/App.java @@ -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(); + } +} diff --git a/Code/Steiner/abstractAufgabe/src/Auto.class b/Code/Steiner/abstractAufgabe/src/Auto.class new file mode 100644 index 0000000..ef28a17 Binary files /dev/null and b/Code/Steiner/abstractAufgabe/src/Auto.class differ diff --git a/Code/Steiner/abstractAufgabe/src/Auto.java b/Code/Steiner/abstractAufgabe/src/Auto.java new file mode 100644 index 0000000..357cfe7 --- /dev/null +++ b/Code/Steiner/abstractAufgabe/src/Auto.java @@ -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."); + } +} \ No newline at end of file diff --git a/Code/Steiner/abstractAufgabe/src/Boot.class b/Code/Steiner/abstractAufgabe/src/Boot.class new file mode 100644 index 0000000..a9e8850 Binary files /dev/null and b/Code/Steiner/abstractAufgabe/src/Boot.class differ diff --git a/Code/Steiner/abstractAufgabe/src/Boot.java b/Code/Steiner/abstractAufgabe/src/Boot.java new file mode 100644 index 0000000..f1fa05a --- /dev/null +++ b/Code/Steiner/abstractAufgabe/src/Boot.java @@ -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."); + } +} \ No newline at end of file diff --git a/Code/Steiner/abstractAufgabe/src/Fahrzeug.class b/Code/Steiner/abstractAufgabe/src/Fahrzeug.class new file mode 100644 index 0000000..6e19196 Binary files /dev/null and b/Code/Steiner/abstractAufgabe/src/Fahrzeug.class differ diff --git a/Code/Steiner/abstractAufgabe/src/Fahrzeug.java b/Code/Steiner/abstractAufgabe/src/Fahrzeug.java new file mode 100644 index 0000000..a76be5c --- /dev/null +++ b/Code/Steiner/abstractAufgabe/src/Fahrzeug.java @@ -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(); +} diff --git a/Code/Steiner/geometryAbstarct/.vscode/settings.json b/Code/Steiner/geometryAbstarct/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/geometryAbstarct/.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/geometryAbstarct/README.md b/Code/Steiner/geometryAbstarct/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/geometryAbstarct/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/geometryAbstarct/bin/App.class b/Code/Steiner/geometryAbstarct/bin/App.class new file mode 100644 index 0000000..bae0935 Binary files /dev/null and b/Code/Steiner/geometryAbstarct/bin/App.class differ diff --git a/Code/Steiner/geometryAbstarct/bin/Form.class b/Code/Steiner/geometryAbstarct/bin/Form.class new file mode 100644 index 0000000..1a8b3f1 Binary files /dev/null and b/Code/Steiner/geometryAbstarct/bin/Form.class differ diff --git a/Code/Steiner/geometryAbstarct/bin/Kreis.class b/Code/Steiner/geometryAbstarct/bin/Kreis.class new file mode 100644 index 0000000..eb0ca00 Binary files /dev/null and b/Code/Steiner/geometryAbstarct/bin/Kreis.class differ diff --git a/Code/Steiner/geometryAbstarct/bin/Position.class b/Code/Steiner/geometryAbstarct/bin/Position.class new file mode 100644 index 0000000..e248c1a Binary files /dev/null and b/Code/Steiner/geometryAbstarct/bin/Position.class differ diff --git a/Code/Steiner/geometryAbstarct/bin/Rechteck.class b/Code/Steiner/geometryAbstarct/bin/Rechteck.class new file mode 100644 index 0000000..bee1e95 Binary files /dev/null and b/Code/Steiner/geometryAbstarct/bin/Rechteck.class differ diff --git a/Code/Steiner/geometryAbstarct/src/App.java b/Code/Steiner/geometryAbstarct/src/App.java new file mode 100644 index 0000000..07ff73d --- /dev/null +++ b/Code/Steiner/geometryAbstarct/src/App.java @@ -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(); + } +} diff --git a/Code/Steiner/geometryAbstarct/src/Form.java b/Code/Steiner/geometryAbstarct/src/Form.java new file mode 100644 index 0000000..6aeb824 --- /dev/null +++ b/Code/Steiner/geometryAbstarct/src/Form.java @@ -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(); +} diff --git a/Code/Steiner/geometryAbstarct/src/Kreis.java b/Code/Steiner/geometryAbstarct/src/Kreis.java new file mode 100644 index 0000000..6572aad --- /dev/null +++ b/Code/Steiner/geometryAbstarct/src/Kreis.java @@ -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); + } +} diff --git a/Code/Steiner/geometryAbstarct/src/Position.java b/Code/Steiner/geometryAbstarct/src/Position.java new file mode 100644 index 0000000..2ed9c0c --- /dev/null +++ b/Code/Steiner/geometryAbstarct/src/Position.java @@ -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); + } +} diff --git a/Code/Steiner/geometryAbstarct/src/Rechteck.java b/Code/Steiner/geometryAbstarct/src/Rechteck.java new file mode 100644 index 0000000..22d7a6b --- /dev/null +++ b/Code/Steiner/geometryAbstarct/src/Rechteck.java @@ -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); + } +} diff --git a/Code/Steiner/giroKonto/.vscode/settings.json b/Code/Steiner/giroKonto/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/giroKonto/.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/giroKonto/README.md b/Code/Steiner/giroKonto/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/giroKonto/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/giroKonto/bin/App.class b/Code/Steiner/giroKonto/bin/App.class new file mode 100644 index 0000000..b468243 Binary files /dev/null and b/Code/Steiner/giroKonto/bin/App.class differ diff --git a/Code/Steiner/giroKonto/bin/Konto.class b/Code/Steiner/giroKonto/bin/Konto.class new file mode 100644 index 0000000..4ecc740 Binary files /dev/null and b/Code/Steiner/giroKonto/bin/Konto.class differ diff --git a/Code/Steiner/giroKonto/src/App.class b/Code/Steiner/giroKonto/src/App.class new file mode 100644 index 0000000..f98e016 Binary files /dev/null and b/Code/Steiner/giroKonto/src/App.class differ diff --git a/Code/Steiner/giroKonto/src/App.java b/Code/Steiner/giroKonto/src/App.java new file mode 100644 index 0000000..c964498 --- /dev/null +++ b/Code/Steiner/giroKonto/src/App.java @@ -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"); + } +} diff --git a/Code/Steiner/giroKonto/src/Konto.class b/Code/Steiner/giroKonto/src/Konto.class new file mode 100644 index 0000000..ce2be72 Binary files /dev/null and b/Code/Steiner/giroKonto/src/Konto.class differ diff --git a/Code/Steiner/giroKonto/src/Konto.java b/Code/Steiner/giroKonto/src/Konto.java new file mode 100644 index 0000000..bf9ac24 --- /dev/null +++ b/Code/Steiner/giroKonto/src/Konto.java @@ -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]"; + } + +} diff --git a/Code/Steiner/simpleCalender/.vscode/settings.json b/Code/Steiner/simpleCalender/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/Code/Steiner/simpleCalender/.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/simpleCalender/README.md b/Code/Steiner/simpleCalender/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/Code/Steiner/simpleCalender/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/simpleCalender/bin/App.class b/Code/Steiner/simpleCalender/bin/App.class new file mode 100644 index 0000000..f17a1ef Binary files /dev/null and b/Code/Steiner/simpleCalender/bin/App.class differ diff --git a/Code/Steiner/simpleCalender/bin/SimpleCalendar.class b/Code/Steiner/simpleCalender/bin/SimpleCalendar.class new file mode 100644 index 0000000..21678f5 Binary files /dev/null and b/Code/Steiner/simpleCalender/bin/SimpleCalendar.class differ diff --git a/Code/Steiner/simpleCalender/src/App.class b/Code/Steiner/simpleCalender/src/App.class new file mode 100644 index 0000000..a7e07ef Binary files /dev/null and b/Code/Steiner/simpleCalender/src/App.class differ diff --git a/Code/Steiner/simpleCalender/src/App.java b/Code/Steiner/simpleCalender/src/App.java new file mode 100644 index 0000000..320ed65 --- /dev/null +++ b/Code/Steiner/simpleCalender/src/App.java @@ -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()); + } +} diff --git a/Code/Steiner/simpleCalender/src/SimpleCalendar.class b/Code/Steiner/simpleCalender/src/SimpleCalendar.class new file mode 100644 index 0000000..695b2d0 Binary files /dev/null and b/Code/Steiner/simpleCalender/src/SimpleCalendar.class differ diff --git a/Code/Steiner/simpleCalender/src/SimpleCalendar.java b/Code/Steiner/simpleCalender/src/SimpleCalendar.java new file mode 100644 index 0000000..ef855ae --- /dev/null +++ b/Code/Steiner/simpleCalender/src/SimpleCalendar.java @@ -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); + } +}