Advertisement
roman_gemini

Java

Feb 5th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. class Lunch {
  2.     public Customer customer;
  3.     public Employee employee;
  4.     void order(String foodName) {
  5.         this.customer.placeOrder(foodName, employee);
  6.     }
  7.     void result() {
  8.         this.customer.printFood();
  9.     }
  10. }
  11.  
  12. class Customer {
  13.     private Food food = null;
  14.     void placeOrder(String foodName, Employee employee) {
  15.         this.food = employee.takeOrder(foodName);
  16.     }
  17.     void printFood() {
  18.         System.out.println(this.food.name);
  19.     }
  20. }
  21.  
  22. class Employee {
  23.     Food takeOrder(String foodName) {
  24.         return new Food(foodName);
  25.     }
  26. }
  27.  
  28. class Food {
  29.     public String name;
  30.     public Food(String name) {
  31.         this.name = name;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement