Skip to content

Instantly share code, notes, and snippets.

@BobGu
Last active May 6, 2016 20:03
Show Gist options
  • Save BobGu/80e87c663e485da51ec618d786375903 to your computer and use it in GitHub Desktop.
Save BobGu/80e87c663e485da51ec618d786375903 to your computer and use it in GitHub Desktop.
public class UnpaidState implements State {
private Order order;
public UnpaidState(Order order) {
this.order = order;
}
public void verifyCreditCard(String info) {
if (verifyCreditCard(info)) {
order.setState(order.getPaidState());
}
}
public void ship() {
System.out.println("Sorry can't ship an item unless it's paid");
}
public void orderDelivered() {
System.out.println("Order hasn't shipped yet!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment