一个应用逻辑题目You are asked to simulate a fast food shop operation

问题描述:

一个应用逻辑题目
You are asked to simulate a fast food shop operation,with people (both consumers and workers) and various kinds of food served at the shop,and perhaps other things,such as time of the day (morning or lunch time).
When it is the busy time like breakfast or lunch,the number of worker or the amount of prepared food might need to be increased.The food already made and stored would have a limited shelf-life.
If the demand for the particular food is low,the over-stocked food might be wasted.Your simulation should be able to show this kind of thing.Some emergent behavior could be happen
something like customers' change of mind.A customer might want to change his or her order
depending on the food on what prepared food is available,assuming they're in a hurry,or they
might prefer freshly made food and decide to wait.
1个回答 分类:英语 2014-10-18

问题解答:

我来补答
时间类应该有private Time t;//时间
估算是lunch 还是supper等的方法(给一个范围就是了.)同时,这些用餐时间到了,要触发相应的动作,增加食物之类的,增加服务员什么的.
对于不同的角色,比如服务员,厨师,清洁工等都是一个类.这些类有一个共同的基类,person类,
peoson类可以提供一个虚函数的接口,这个可以命名display(),每个人角色不同,干的事也就不同你可以定义他们的属性,由于你题目里没有要求对这些对象操作,没有什么管理之类的操作,可以不加什么.但是每个类都应该实现父类的虚函数接口……
关键的类不是上面的,对于上面的类你没有特别要求,食品的属性这些自己定义.
对于改order这个不难,costomer把order给服务员,服务员来取食物.由于食物是储备好的,中间可以打断,只要没有完成这个过程,在编程时可以设置几秒中的时间作为取食物时间进行模拟.
对于用户们的喜好,这要抽样统计的(如果觉得没法模拟,可以这样,以每天来的前50个顾客的菜单为样本,统计出最受喜爱,中等和最不受喜爱的食物),这只要一个数据结构就ok,然后显示食物是多储备了还是少了,好让厨师进行处理.
如果是关键课程的大作业,这个题目要用到Order
Pattern ,楼主可以百度这个pattern.
 
 
展开全文阅读
剩余:2000