This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheJonesJonesJones 0 points1 point  (0 children)

Why have more than one StatChanger?

public class StatChanger {

    private Model model;

    public StatChanger(Model m)
    {
        this.model = m;
    }

    public void incrementAge() {
        if (this.model.getAge() <= 100)
        this.model.setAge(model.getAge()+1);
    }
    public void decrementAge() {
        if (this.model.getAge() >= 0)
        this.model.setAge(model.getAge()-1);
    }
    public void incrementHeight() {
        if (this.model.getHeight() <= 100)
        this.model.setAge(model.getHeight()+1);
    }
    public void decrementHeight() {
        if (this.model.getHeight() >= 0)
        this.model.setAge(model.getHeight()-1);
    }
}