Compare commits

...

1 Commits

Author SHA1 Message Date
Armin Omanovic 0f6c3ed06b Add OOP Bankkonto 2026-10-07 08:02:59 +02:00
12 changed files with 105 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).

View File

@ -0,0 +1,55 @@
package main.pr2.exercise.e01_banking;
/** This class represents a model for banking accounts.
* Other possible accounts can be extended
* @author Armin Omanovic
* @author Christian Hauff
* @version 1.0
*
*/
public class Account {
private double kontostand = 0;
/** This method returns the current account balance
*
* @return the account balance
*/
public double getBalance(){
System.out.println("Ihr Kontostand beträgt: " + kontostand);
return kontostand;
}
/** This method deposits the specified amount.
* The amount needs to be greater than 0.
* @param amount the int you deposit
* @return the account balance after the deposit
*
*/
public double deposit(int amount){
if(amount <= 0){
System.out.println("Der Betrag kann nicht 0 oder kleiner betragen!");
return kontostand;
}else{
kontostand += amount;
return kontostand;
}
}
/** This method withdraws the specified amount.
* The amount has to be greater than 0.
*
* @param amount the int you withdraw
* @return the account balance after the withdrawal
*/
public double withdraw(int amount){
if(amount <= 0){
System.out.println("Der Betrag kann nicht 0 oder kleiner betragen!");
return kontostand;
}else{
kontostand -= amount;
return kontostand;
}
}
}

View File

@ -0,0 +1,8 @@
package main.pr2.exercise.e01_banking;
public class App {
public static void main(String[] args) throws Exception {
//Bankkonto Aufgabe
}
}

View File

@ -0,0 +1,7 @@
package main.pr2.exercise.e01_banking;
public class LimitedAccount extends Account{
}

View File

@ -0,0 +1,5 @@
package main.pr2.exercise.e01_banking;
public class PrepaidAccunt extends Account {
}

View File

@ -0,0 +1,5 @@
package main.pr2.exercise.e01_banking;
public class UnlimitedAccount extends Account {
}