info-java/Aktienhandel/Person.java

20 lines
487 B
Java
Executable File

public class Person {
protected String name;
protected int age;
protected double money;
public Person(String name, int age, double money) {
this.name = name;
this.age = age;
this.money = money;
}
public void geldEinzahlen(double amt) {
this.money += amt;
}
public void geldAuszahlen(double amt) {
this.money -= (this.money < amt) ? 0 : amt;
}
public void show() {
System.out.println("Name: " + name + ", Age: " + age + ", Money: " + money);
}
}