ahhhhhhhhhhhh
This commit is contained in:
parent
7836821c51
commit
7663a81750
50 changed files with 860 additions and 341 deletions
7
Code/Steiner/hotelBookKeeping/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/hotelBookKeeping/.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/hotelBookKeeping/README.md
Normal file
18
Code/Steiner/hotelBookKeeping/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/hotelBookKeeping/bin/Euro.class
Normal file
BIN
Code/Steiner/hotelBookKeeping/bin/Euro.class
Normal file
Binary file not shown.
BIN
Code/Steiner/hotelBookKeeping/bin/USDollar.class
Normal file
BIN
Code/Steiner/hotelBookKeeping/bin/USDollar.class
Normal file
Binary file not shown.
BIN
Code/Steiner/hotelBookKeeping/bin/Waehrung.class
Normal file
BIN
Code/Steiner/hotelBookKeeping/bin/Waehrung.class
Normal file
Binary file not shown.
BIN
Code/Steiner/hotelBookKeeping/bin/WaehrungTest.class
Normal file
BIN
Code/Steiner/hotelBookKeeping/bin/WaehrungTest.class
Normal file
Binary file not shown.
BIN
Code/Steiner/hotelBookKeeping/bin/Yen.class
Normal file
BIN
Code/Steiner/hotelBookKeeping/bin/Yen.class
Normal file
Binary file not shown.
16
Code/Steiner/hotelBookKeeping/src/Euro.java
Normal file
16
Code/Steiner/hotelBookKeeping/src/Euro.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
class Euro extends Waehrung {
|
||||
private static double kurs;
|
||||
|
||||
public Euro(double betrag) {
|
||||
super(betrag);
|
||||
}
|
||||
|
||||
public static void setKurs(double kurs) {
|
||||
Euro.kurs = kurs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double dollarBetrag() {
|
||||
return getBetrag() * kurs;
|
||||
}
|
||||
}
|
11
Code/Steiner/hotelBookKeeping/src/USDollar.java
Normal file
11
Code/Steiner/hotelBookKeeping/src/USDollar.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
class USDollar extends Waehrung {
|
||||
|
||||
public USDollar(double betrag) {
|
||||
super(betrag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double dollarBetrag() {
|
||||
return this.getBetrag();
|
||||
}
|
||||
}
|
17
Code/Steiner/hotelBookKeeping/src/Waehrung.java
Normal file
17
Code/Steiner/hotelBookKeeping/src/Waehrung.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
abstract class Waehrung {
|
||||
private double betrag;
|
||||
|
||||
public Waehrung(double betrag) {
|
||||
this.betrag = betrag;
|
||||
}
|
||||
|
||||
public double getBetrag() {
|
||||
return betrag;
|
||||
}
|
||||
|
||||
public void setBetrag(double betrag) {
|
||||
this.betrag = betrag;
|
||||
}
|
||||
|
||||
public abstract double dollarBetrag();
|
||||
}
|
25
Code/Steiner/hotelBookKeeping/src/WaehrungTest.java
Normal file
25
Code/Steiner/hotelBookKeeping/src/WaehrungTest.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
public class WaehrungTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Yen.setKurs(1.0 / 130);
|
||||
Euro.setKurs(1.0 / 1.05);
|
||||
Waehrung[] geld = new Waehrung[5];
|
||||
geld[0] = new USDollar(2500);
|
||||
geld[1] = new Yen(200000);
|
||||
geld[2] = new Euro(600);
|
||||
geld[3] = new USDollar(20);
|
||||
geld[4] = new Euro(500);
|
||||
double dollarGeldBetrag = berechneDollarGeldBetrag(geld);
|
||||
System.out.println(dollarGeldBetrag);
|
||||
}
|
||||
|
||||
public static double berechneDollarGeldBetrag(Waehrung[] geld) {
|
||||
double summeInDollar = 0;
|
||||
for (Waehrung waehrung : geld) {
|
||||
summeInDollar += waehrung.dollarBetrag();
|
||||
}
|
||||
return summeInDollar;
|
||||
|
||||
}
|
||||
|
||||
}
|
16
Code/Steiner/hotelBookKeeping/src/Yen.java
Normal file
16
Code/Steiner/hotelBookKeeping/src/Yen.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
class Yen extends Waehrung {
|
||||
private static double kurs;
|
||||
|
||||
public Yen(double betrag) {
|
||||
super(betrag);
|
||||
}
|
||||
|
||||
public static void setKurs(double kurs) {
|
||||
Yen.kurs = kurs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double dollarBetrag() {
|
||||
return getBetrag() * kurs;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue