Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Lunch {
- public Customer customer;
- public Employee employee;
- void order(String foodName) {
- this.customer.placeOrder(foodName, employee);
- }
- void result() {
- this.customer.printFood();
- }
- }
- class Customer {
- private Food food = null;
- void placeOrder(String foodName, Employee employee) {
- this.food = employee.takeOrder(foodName);
- }
- void printFood() {
- System.out.println(this.food.name);
- }
- }
- class Employee {
- Food takeOrder(String foodName) {
- return new Food(foodName);
- }
- }
- class Food {
- public String name;
- public Food(String name) {
- this.name = name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement