I have no answer to the question but i assume its because it only has void methods that are only counting anyway. Or is there a better explaination? I also need to make a suggestion to improve it.
public class PlayingField implements Security{
private int kidsCount;
@Override
public void addPerson() {
kidsCount++;
soundAlarm();
}
@Override
public void removePerson() {
kidsCount--;
}
@Override
public int getPersonCount() {
return kidsCount;
}
@Override
public void soundAlarm() {
if (kidsCount> 50) {
System.out.println("cant add a kid to the PlayingField");
kidsCount--;
}
}
}
the methods are called from another class with the following methods:
public class KidsShop extends FashionShop {
private PlayingField playingField;
public KidsShop(String name, int area, int rent) {
super(name, area, rent);
this.playingField = new PlayingField();
}
public void addKid() {
playingField.addPerson();
}
public void pickUpKid() {
playingField.removePerson();
}
public int getNumberOfKids() {
return playingField.getPersonCount();
}