info-java/Aktienhandel/Aktie.java

38 lines
788 B
Java
Executable File

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;
}
}