Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case class Lunch(customer: Customer, employee: Employee) {
- def order(foodName: String) =
- this.customer.placeOrder(foodName, employee)
- def result() = this.customer.printFood()
- }
- case class Customer(var food: Food) {
- def placeOrder(foodName: String, employee: Employee) =
- this.food = employee.takeOrder(foodName)
- def printFood(): Unit = System.out.println(this.food.name)
- }
- class Employee {
- def takeOrder(foodName: String): Food = Food(foodName)
- }
- case class Food(name: String)
Add Comment
Please, Sign In to add comment