static void Main(string[] args) { //初始化客户、服务员、厨师 Client wang = new Client(); Waitress waitress = new Waitress(); Waitress zhang = new Waitress(); Chef chef = new Chef(); //初始化点菜单 Order order = new Order(); order.customer = wang; order.id = 100; order.mealList = "水煮鱼"; //顾客client选中waitress服务员给自己服务 wang.Order(waitress, order); //服务员将菜单信息告知厨师chef waitress.SendOrder(chef); //厨师根据菜单做菜 chef.Cook(); chef.SendAlert(zhang); zhang.TransCook(); Console.Read(); }
/// <summary> /// 提醒饭菜制作完毕 /// </summary> /// <param name="waitress"></param> public void SendAlert(Waitress waitress) { Console.WriteLine("厨师提示服务员取菜!"); waitress.GetOrder(order); }
/// <summary> /// 点菜 /// </summary> public void Order(Waitress waitress, Order order) { Console.WriteLine("顾客开始点菜:{0}!", order.mealList); waitress.GetOrder(order); }