Project

General

Profile

Actions

text_question #15018

open

answer_id= desc=Pytho name=餐厅订单管 pod_templa grading_ru

Added by UserName LastName about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
01/15/2025
Due date:
% Done:

0%

Estimated time:
name:
餐厅订单管理系统
score:
10.0
topic_type:

编程题
...

tag:
desc:

"Python编程实现:餐厅订单管理系统\n\n1. 基础功能:\n - 创建一个基类 `Restaurant`,包含餐厅名称 `name`、菜单 `menu`(字典,`{菜品名称:\
\ 价格}`)和顾客订单 `orders`(列表,存储订单信息)。\n - 提供方法 `display_menu` 展示餐厅菜单。\n - 提供方法 `add_dish`,接收菜品名称\
\ `dish_name` 和菜品价格 `price` 两个参数。\n\n2. 扩展功能:\n - 创建 `FastFoodRestaurant` 类,继承自\
\ `Restaurant`。\n - 新增打折功能 `set_discount`(可为某些菜品设置折扣)。接收菜品名称 `dish_name` 和菜品折扣后的价格\
\ `discount_price` 两个参数。\n - 打折菜品信息记录在实例变量 `discounts` 中(字典,`{菜品名称: 折扣后价格}`)\n\
\n3. 顾客操作:\n - `Restaurant` 提供 `add_order` 方法,接收顾客姓名 `customer_name`、菜品名称 `dish_name`、菜品数量\
\ `quantity` 三个参数。允许顾客根据菜品名称和数量下单,检查菜品是否存在,计算总金额并添加到订单列表中。订单数据格式为:`{\"customer_name\"\
: \"name\", \"order\": {\"dish\": quantity}, \"total\": amount}`\n - `Restaurant`\
\ 提供 `display_orders` 方法,展示所有顾客订单,格式为:`顾客名: 菜品1 x 数量, 菜品2 x 数量 ---- 总金额`.\n\n4.\
\ 高级功能:\n - 使用多态设计一个方法 `welcome_message`,支持不同餐厅展示不同的欢迎语。\n"

is_delete:
false
answer_id:
15017
tags:

- 11052

grading_rules_id:
14976
pod_template_id:
11364

No data to display

Actions

Also available in: Atom PDF