added Aktienhandel
This commit is contained in:
37
Aktienhandel/Aktie.java
Executable file
37
Aktienhandel/Aktie.java
Executable file
@ -0,0 +1,37 @@
|
||||
public class Aktie{
|
||||
private String name;
|
||||
private int count;
|
||||
private double value;
|
||||
public Aktie(String name, int count, double value) {
|
||||
this.name = name;
|
||||
this.count = count;
|
||||
this.value = value;
|
||||
}
|
||||
public double getAktienWert() {
|
||||
return count * value;
|
||||
}
|
||||
public void anzahlErhoehen(int amt) {
|
||||
this.count += amt;
|
||||
}
|
||||
public void anzahlVerringern(int amt) {
|
||||
this.count -= (this.count < amt) ? 0 : amt;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
public double getValue() {
|
||||
return this.value;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user