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.

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

Binary file not shown.

View 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]";
}
}