參考肯德基官網(wǎng)的信息模擬肯德基快餐店的收銀系統(tǒng),合理使用C++或Java或Python結(jié)合設(shè)計(jì)模式(2種以上)至少實(shí)現(xiàn)系統(tǒng)的以下功能:
在成都做網(wǎng)站、網(wǎng)站建設(shè)中從網(wǎng)站色彩、結(jié)構(gòu)布局、欄目設(shè)置、關(guān)鍵詞群組等細(xì)微處著手,突出企業(yè)的產(chǎn)品/服務(wù)/品牌,幫助企業(yè)鎖定精準(zhǔn)用戶,提高在線咨詢和轉(zhuǎn)化,使成都網(wǎng)站營(yíng)銷(xiāo)成為有效果、有回報(bào)的無(wú)錫營(yíng)銷(xiāo)推廣。成都創(chuàng)新互聯(lián)專(zhuān)業(yè)成都網(wǎng)站建設(shè)10余年了,客戶滿意度97.8%,歡迎成都創(chuàng)新互聯(lián)客戶聯(lián)系。
1.正常餐品結(jié)算和找零。
2.基本套餐結(jié)算和找零。
3.使用優(yōu)惠券購(gòu)買(mǎi)餐品結(jié)算和找零。
4.可在一定時(shí)間段參與店內(nèi)活動(dòng)(自行設(shè)計(jì)或參考官網(wǎng)信息)。
5.模擬打印小票的功能(寫(xiě)到文件中)。
小票信息保存
class print{ String s=""; //存訂單信息 }
食物工廠
interface FoodFactory{ public Hamburger createHamburger(print s,int kind,int num); //生產(chǎn)漢堡包 public Drink createDrink(print s,int kind,int num); //生產(chǎn)飲品 public Chicken createChicken(print s,int kind,int num); //生產(chǎn)雞肉類(lèi) public Sweetmeats createSweetmeats(print s,int kind,int num); //生產(chǎn)甜品 public Snack createSnack(print s,int kind,int num); //生產(chǎn)小吃 public FrenchFries createFrenchFries(print s,int kind,int num); //生產(chǎn)薯?xiàng)l public SetMeal createSetMeal(print s,int kind,int num); //生產(chǎn)套餐 }
具體食物工廠
interface Hamburger{ public double price(int num); } interface Drink{ public double price(int num); } interface Chicken{ public double price(int num); } interface Sweetmeats{ public double price(int num); } interface Snack{ public double price(int num); } interface FrenchFries{ public double price(int num); } interface SetMeal{ public double price(int num); }
具體食物
//漢堡 //奧爾良烤堡 class Hamburger_1 implements Hamburger{ public double price(int num) { System.out.println("奧爾良烤堡"+" "+" 數(shù)量:"+num+" "+"合計(jì):"+(num*8)); return num*8; //返回價(jià)格 } } //香辣雞腿堡 class Hamburger_2 implements Hamburger{ public double price(int num) { System.out.println("香辣雞腿堡"+" "+" 數(shù)量:"+num+" "+"合計(jì):"+(num*9)); return num*9; } } //勁脆雞腿堡 class Hamburger_3 implements Hamburger{ public double price(int num) { System.out.println("勁脆雞腿堡"+" "+" 數(shù)量:"+num+" "+"合計(jì):"+(num*10)); return num*10; } } //飲品 //橙汁 class Drink_1 implements Drink{ public double price(int num) { System.out.println("橙汁"+" "+" 數(shù)量:"+num+" "+"合計(jì):"+(num*7)); return num*7; //返回價(jià)格 } } //百事可樂(lè) class Drink_2 implements Drink{ public double price(int num) { System.out.println("百事可樂(lè)"+" "+" 數(shù)量:"+num+" "+"合計(jì):"+(num*8)); return num*8; } } //百威啤酒 class Drink_3 implements Drink{ public double price(int num) { System.out.println("百威啤酒"+" "+" 數(shù)量:"+num+" "+"合計(jì):"+(num*9)); return num*9; } } //雞肉類(lèi) //老北京雞肉卷 class Chicken_1 implements Chicken{ public double price(int num) { System.out.println("老北京雞肉卷"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*9)); return num*9; //返回價(jià)格 } } //香辣雞翅 class Chicken_2 implements Chicken{ public double price(int num) { System.out.println("香辣雞翅"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*13)); return num*13; } } //雞排 class Chicken_3 implements Chicken{ public double price(int num) { System.out.println("雞排"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*10)); return num*10; } } //甜品 //原味圣代 class Sweetmeats_1 implements Sweetmeats{ public double price(int num) { System.out.println("原味圣代"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*9)); return num*9; //返回價(jià)格 } } //葡式蛋撻 class Sweetmeats_2 implements Sweetmeats{ public double price(int num) { System.out.println("葡式蛋撻"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*12)); return num*12; } } //巧克力味華夫 class Sweetmeats_3 implements Sweetmeats{ public double price(int num) { System.out.println("巧克力味華夫"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*10)); return num*10; } } //小吃 //蔬菜沙拉 class Snack_1 implements Snack{ public double price(int num) { System.out.println("蔬菜沙拉"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*10)); return num*10; //返回價(jià)格 } } //醇香土豆泥 class Snack_2 implements Snack{ public double price(int num) { System.out.println("醇香土豆泥"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*11)); return num*11; } } //香甜粟米棒 class Snack_3 implements Snack{ public double price(int num) { System.out.println("香甜粟米棒"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*6)); return num*6; } } //薯?xiàng)l //波紋霸王薯?xiàng)l class FrenchFries_1 implements FrenchFries{ public double price(int num) { System.out.println("波紋霸王薯?xiàng)l"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*12)); return num*12; //返回價(jià)格 } } //套餐 //套餐1 class SetMeal_1 implements SetMeal{ public double price(int num) { System.out.println("香辣雞翅+百事可樂(lè)"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*17)); return num*17; } } //套餐2 class SetMeal_2 implements SetMeal{ public double price(int num) { System.out.println("勁脆雞腿堡+橙汁"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*15)); return num*15; } } //套餐3 class SetMeal_3 implements SetMeal{ public double price(int num) { System.out.println("香辣雞腿堡+百威啤酒+波紋霸王薯?xiàng)l"+" "+"數(shù)量:"+num+" "+"合計(jì):"+(num*25)); return num*25; } }
生產(chǎn)具體食物
//生產(chǎn)具體食物 class createFood implements FoodFactory{ print p=new print(); public Hamburger createHamburger(print s,int kind,int num) { if(kind==1){ s.s=s.s+"\n"+"奧爾良漢堡 單價(jià):"+"8"+" 數(shù)量:"+num+" 合計(jì):"+(num*8); //將信息保存至s中 return new Hamburger_1();} else if(kind==2) { s.s=s.s+"\n"+"香辣雞腿堡 單價(jià):"+"9"+" 數(shù)量:"+num+" 合計(jì):"+(num*9); return new Hamburger_2();} else if(kind==3) { s.s=s.s+"\n"+"勁脆雞腿堡 單價(jià):"+"10"+" 數(shù)量:"+num+" 合計(jì):"+(num*10); return new Hamburger_3();} else return null; } public Drink createDrink(print s,int kind,int num) { if(kind==1) { s.s=s.s+"\n"+"橙汁 單價(jià):"+"7"+" 數(shù)量:"+num+" 合計(jì):"+(num*7); //將信息保存至s中 return new Drink_1();} else if(kind==2) { s.s=s.s+"\n"+"百事可樂(lè) 單價(jià):"+"8"+" 數(shù)量:"+num+" 合計(jì):"+(num*8); return new Drink_2();} else if(kind==3) { s.s=s.s+"\n"+"百威啤酒 單價(jià):"+"9"+" 數(shù)量:"+num+" 合計(jì):"+(num*9); return new Drink_3();} else return null; } public Chicken createChicken(print s,int kind,int num) { if(kind==1) { s.s=s.s+"\n"+"老北京雞肉卷 單價(jià):"+"9"+" 數(shù)量"+num+" 合計(jì):"+(num*9); //將信息保存至s中 return new Chicken_1();} else if(kind==2) { s.s=s.s+"\n"+"香辣雞翅 單價(jià):"+"13"+" 數(shù)量"+num+" 合計(jì):"+(num*13); return new Chicken_2();} else if(kind==3) { s.s=s.s+"\n"+"雞排 單價(jià):"+"10"+" 數(shù)量"+num+" 合計(jì):"+(num*10); return new Chicken_3();} else return null; } public Sweetmeats createSweetmeats(print s,int kind,int num) { if(kind==1) { s.s=s.s+"\n"+"原味圣代 單價(jià):"+"9"+" 數(shù)量"+num+" 合計(jì):"+(num*9); //將信息保存至s中 return new Sweetmeats_1();} else if(kind==2) { s.s=s.s+"\n"+"葡式蛋撻 單價(jià):"+"12"+" 數(shù)量"+num+" 合計(jì):"+(num*12); return new Sweetmeats_2();} else if(kind==3) { s.s=s.s+"\n"+"巧克力味華夫 單價(jià):"+"10"+" 數(shù)量"+num+" 合計(jì):"+(num*10); return new Sweetmeats_3();} else return null; } public Snack createSnack(print s,int kind,int num) { if(kind==1) { s.s=s.s+"\n"+"蔬菜沙拉 單價(jià):"+"10"+" 數(shù)量"+num+" 合計(jì):"+(num*10); //將信息保存至s中 return new Snack_1();} else if(kind==2) { s.s=s.s+"\n"+"醇香土豆泥 單價(jià):"+"11"+" 數(shù)量"+num+" 合計(jì):"+(num*11); return new Snack_2();} else if(kind==3) { s.s=s.s+"\n"+"香甜粟米棒 單價(jià):"+"6"+" 數(shù)量"+num+" 合計(jì):"+(num*6); return new Snack_3();} else return null; } public FrenchFries createFrenchFries(print s,int kind,int num){ if(kind==1) { s.s=s.s+"\n"+"波紋霸王薯?xiàng)l 單價(jià):"+"12"+" 數(shù)量"+num+" 合計(jì):"+(num*12); //將信息保存至s中 return new FrenchFries_1();} else return null; } public SetMeal createSetMeal(print s,int kind, int num) { if(kind==1) { s.s=s.s+"\n"+"套餐1 單價(jià):"+"17"+" 數(shù)量"+num+" 合計(jì):"+(num*17); //將信息保存至s中 return new SetMeal_1();} else if(kind==2) { s.s=s.s+"\n"+"套餐2 單價(jià):"+"15"+" 數(shù)量"+num+" 合計(jì):"+(num*15); return new SetMeal_2();} else if(kind==3) { s.s=s.s+"\n"+"套餐3 單價(jià):"+"25"+" 數(shù)量"+num+" 合計(jì):"+(num*25); return new SetMeal_3();} else return null; } }
訂購(gòu)食物,返回價(jià)格
class Price{ public FoodFactory create; //構(gòu)造方法將抽象工廠傳入 public Price(FoodFactory create) { this.create=create; } public double orderHamburger(print s,int kind,int num) { Hamburger hamburger=create.createHamburger(s,kind, num); return hamburger.price(num); } public double orderDrink(print s,int kind,int num) { Drink drink=create.createDrink(s,kind, num); return drink.price(num); } public double orderChicken(print s,int kind,int num) { Chicken chicken=create.createChicken(s,kind, num); return chicken.price(num); } public double orderSweetmeats(print s,int kind,int num) { Sweetmeats sweetmeats=create.createSweetmeats(s,kind, num); return sweetmeats.price(num); } public double orderSnack(print s,int kind,int num) { Snack snack=create.createSnack(s,kind, num); return snack.price(num); } public double orderFrenchFries(print s,int kind,int num) { FrenchFries frenchFries=create.createFrenchFries(s,kind, num); return frenchFries.price(num); } public double orderSetMeal(print s,int kind,int num) { SetMeal setMeal=create.createSetMeal(s,kind, num); return setMeal.price(num); } }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。
本文題目:java實(shí)現(xiàn)肯德基收銀系統(tǒng)
文章路徑:http://jinyejixie.com/article6/pphoig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、微信小程序、標(biāo)簽優(yōu)化、微信公眾號(hào)、做網(wǎng)站、App開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)