python面向对象

def ydrz():
    print("引导入座")
def dcd():
    print("递菜单")
def dc():
    print("点餐")
def gscscd():
    print("告诉厨师菜谱")
def zc():
    print("做菜")
def yc():
    print("用餐")
def jscf():
    print("计算餐费")
def zfcf():
    print("支付餐费")
def sqcf():
    print("收取餐费")


ydrz()
dcd()
dc()
gscscd()
zc()
yc()
jscf()
zfcf()
sqcf()

 

class Waiter():
    def ydrz(self):
        print("引导入座")

    def dcd(self):
        print("递菜单")

    def gscscd(self):
        print("告诉厨师菜谱")


class Customer():
    def dc(self):
        print("点餐")

    def yc(self):
        print("用餐")

    def zfcf(self):
        print("支付餐费")

class Cook():
    def zc(self):
        print("做菜")

class Cashier():
    def jscf(self):
        print("计算餐费")

    def sqcf(self):
        print("收取餐费")


zhangsan=Customer()
xiaoming=Waiter()
laowang=Cook()
xiaohong=Cashier()
xiaoming.ydrz()
xiaoming.dcd()
zhangsan.dc()
xiaoming.gscscd()
laowang.zc()
zhangsan.yc()
xiaohong.jscf()
zhangsan.zfcf()
xiaohong.sqcf()

 

 

#NewCookWaiter
from Cook import *
from Waiter import *

class NewCookWaiter(Cook,Waiter):
    def __init__(self, name, gender, tel):
        self.name = name
        self.gender = gender
        self.tel = tel

 

 

from Customer import *
from Waiter import *
from Cook import *
from Cashier import *
from NewCook import *
from NewCookWaiter import *







zhangsan=Customer('张三',32,'11111111111')
xiaoming=Waiter('小明',20,'22222222222')
laowang=Cook('老王',52,'33333333333')
xiaowang=NewCook('小王',19,'55555555555')
xiaohong=Cashier('小红',25,'44444444444')
xiaogang=NewCookWaiter('小刚',22,"6666666666")

xiaoming.ydrz()
xiaoming.dcd()
zhangsan.dc()
xiaoming.gscscd()
laowang.zc()
xiaowang.zc()
xiaowang.zmb()
zhangsan.yc()
xiaohong.jscf()
zhangsan.zfcf()
xiaohong.sqcf()
xiaogang.zc()
xiaogang.ydrz()

 

 

posted @ 2024-05-29 08:57  szmtjs10  阅读(5)  评论(0编辑  收藏  举报