Adding Servant Design pattern classes

This commit is contained in:
Peter G. Sideris
2014-12-01 14:23:08 +01:00
parent 710d31b2a2
commit 187cccca99
6 changed files with 180 additions and 0 deletions
@@ -0,0 +1,31 @@
package com.iluwatar;
import java.util.ArrayList;
public class Servant {
public String name;
public Servant(String name){
this.name = name;
}
public void feed(Royalty r){
r.feed();
}
public void giveWine(Royalty r){
r.giveDrink();
}
public void GiveCompliments(Royalty r){
r.receiveCompliments();
}
public boolean checkIfYouWillBeHanged(ArrayList<Royalty> tableGuests){
boolean anotherDay = true;
for( Royalty r : tableGuests )
if( !r.getMood() ) anotherDay = false;
return anotherDay;
}
}