mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 16:58:56 +00:00
32 lines
534 B
Java
32 lines
534 B
Java
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.getFed();
|
|
}
|
|
|
|
public void giveWine(Royalty r){
|
|
r.getDrink();
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|