欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    2022年面向对象程序设计A课程设计 .pdf

    • 资源ID:26875151       资源大小:1.11MB        全文页数:33页
    • 资源格式: PDF        下载积分:4.3金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要4.3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    2022年面向对象程序设计A课程设计 .pdf

    面向对象程序课程设计(2017/2018 学年第二学期第17 周)指导教师:XXX 班级: XXX 学号: XXXX 姓名: XXX 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 33 页 - - - - - - - - - 面向对象程序课程设计任务书【题目】 自助点餐系统【目的】通过设计一个小型的自助点餐系统,训练综合运用所学知识处理实际问题的能力,强化面向对象的程序设计理念,使自己的程序设计与调试水平有一个明显的提高。【要求】1、每个学生必须独立完成;2、课程设计时间为1 周;3、设计语言采用 C+;4、学生有事离校必须请假。课程设计期间,无故缺席按旷课处理;缺席时间达四分之一以上者,未按规定上交实验报告的学生,其成绩按不及格处理。【内容简介】有一个小型餐厅,现在这个餐厅打算使用自助点餐系统,方便顾客自己点餐,并提供对餐厅销售情况的统计和管理功能。【考核标准】该系统为两种角色的用户提供服务,一种是餐厅管理员,一种是顾客。餐厅管理员根据账号、密码登录系统。顾客无需登录即可使用系统。1、 顾客通过该餐厅在系统中提供的菜单为自己点餐,菜单以文件形式保存。系统能够根据顾客的要求正确打出订单,订单内容包括订单编号、菜品名称、每个菜品的价格、份数、折扣等;订单分两种,一种是在店消费,在店消费要求包括餐桌号,是否有包厢费,另一种是外卖,外卖要求包括送餐时间,送餐地点,客户手机号,外卖服务费。(要求用继承和多态实现) ,成绩 60;2、 系统退出后能保存当天的订单信息,要求每天一个文档,文档名按照日期命名。餐厅管理员可以根据订单编号查找删除修改某个订单,订单可以按照下单时间先后排序,成名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 33 页 - - - - - - - - - 绩70;3、 能够实现对餐厅菜式和价格的管理,包括对菜品和对应价格的增加、修改、删除、查找,折扣的设置,成绩80;4、 系统可根据历史记录对销售情况进行统计,根据餐厅管理员的输入日期统计某天的销售情况并显示(包括一共接了多少单,销售额是多少,各个菜品的销售情况,外卖和在店销售的占比),成绩 90;要求:用面向对象的程序设计方法设计该系统。本系统涉及的基本对象有订单对象(包括外卖订单和在店消费订单) 、订单管理对象、菜单对象、菜品对象、菜品管理对象、系统界面。实现对这些对象的合理抽象和封装,正确定义类之间的关系。界面合理,代码文件组织清晰,命名符合规范,代码注释清楚,课程设计报告质量高。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 33 页 - - - - - - - - - 面向对象程序课程设计目录一、 题目有一个小型餐厅,现在这个餐厅打算使用自助点餐系统,方便顾客自己点餐,并提供对餐厅销售情况的统计和管理功能。二、 需求分析有一个小型餐厅,该餐厅提供即时就餐和外卖服务。方便顾客自己点餐,并提供对餐厅销售情况的统计和管理功能。1、根据顾客的选择正确打出订单。2、统计出每一天的订单并将之保存在文件中。3、可以通过管理员功能对订单,菜品等进行操作。三、 系统结构图名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 33 页 - - - - - - - - - 四、 类的设计名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 33 页 - - - - - - - - - 五、 程序代码与说明Face.h #ifndef Face_h #defineFace_h#includeOrderMana.hclassFace private: OrderMana shard; public : void start(); / 定义开始界面void Adm(); / 定义管理员登入界面void Adm1(); / 定义管理员界面void AdmOrder(); / 查找修改删除订单void AdmVege(); / 菜式和价格的管理void AdmSell(); / 查看销售情况void client(); / 定义客户界面void AdmVegeI(); / 添加菜品void AdmVegeII(); / 修改菜品void AdmVegeIII(); / 删除菜品名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 33 页 - - - - - - - - - void AdmVegeV(); / 查找菜品void AdmVegeVI(); / 设置折扣void AdmOrderI(); / 查找订单void AdmOrderII(); / 修改订单void AdmOrderIII(); / 删除订单; #endif Mana.h #ifndef Mana_h #defineMana_h#includemenu.h#include#includeusingnamespace std; classMana : publicMenu private: string kind; / 订单种类string tim, address, phone; / 送餐时间,送餐地点,客户手机号int table, Allmoney; / 座位号,总价bool a; / 是否有包厢费public : string Numble; / 订单编号Mana(string numble, string kind,string tim, string address, string phone); Mana(string numble, string kind,int table, bool a); void setAllmoney(int money); string getKind() return kind; ; string getTim() return tim; ; string getAddress() return address; ; string getphone() return phone; ; int getTable() return table; ; int getAllmoney() return Allmoney; ; bool getA() return a; ; string getNumble() return Numble; ; void insert(string Vege, double money, int num, double discount); ; #endif menu.h #ifndef Menu_h #defineMenu_h#include#include#includevegetalbe.husingnamespace std; classMenu private: 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 33 页 - - - - - - - - - Vegetalbe *p; public : list members; list ord; void insert(string Vege, int num); / 记录顾客挑选菜单virtualvoid insert(string Vege, double money, int num, double discount); void txtinsert(); / 记录原有菜单void printmembers(); / 输出原有菜单void printord(); / 输出顾客菜单void pushnew( Vegetalbe &b); / 添加菜单string number(); / 订单编码void dleinsert(string Vege); / 删除菜品Menu(); ; #endif order.h #ifndef Order_h #defineOrder_h#includeusingnamespace std; classOrder private: string account; string code; public : Order( string account, string code); bool judge(); ; #endif OrderMana.h #ifndef OrderMana_h #defineOrderMana_h#includeMana.h#includemenu.h#include#includeusingnamespace std; classOrderMana private: double BossMoney = 0; / 销售额int Fre = 0; / 接了多少单double Spec; / 外卖和在店销售的占比double TakeOut=0; / 外卖次数名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 33 页 - - - - - - - - - double InShop=0; / 在店次数Mana *p; public : list members; list ord; double getBossMoney(); / 输出相应日期的销售金额void txtinsertI(Menu *p, string tim, string address, string phone, string number); / 打印外卖订单void txtinsertII(Menu *p, bool a, int x, string number); / 打印在店订单void txtinsertMana(string day); / 获取本地订单void findMana( string numble); / 查找订单void pushit(Mana *re); / 输出订单void dleinsertM(string numble); / 删除订单double getSpec() return TakeOut / InShop; ; double getTakeOut() return TakeOut; ; double getInShop() return InShop; ; int getFre() return Fre; ; ; #endif vegetalbe.h #ifndef Vegetalbe_h #defineVegetalbe_h#includeusingnamespace std; classVegetalbe private: string name; double money; int num; double discount; public : Vegetalbe( stringname , doublemoney , doublediscount ) this -name = name ; this -money = money ; this -discount = discount ; ; Vegetalbe( stringname , doublemoney , intnum , doublediscount ) this -name = name ; this -money = money ; this -num = num ; this -discount = discount ; ; / 修改菜品voidSetVegetalbe( stringname , doublemoney , doublediscount ) this -name = name ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 33 页 - - - - - - - - - this -money = money ; this -discount = discount ; ; string getname() return name; double getmoney() return money; void setnum( intx) this -num = x; int getnum() return num; double getdiscount() return discount; ; #endif interface.cpp #includeFace.h#includeorder.h#includemenu.h#include#include#include #include usingnamespace std; / 定义开始界面voidFace:start() cout endl; cout ttt欢迎使用自助点餐系统ttt endl; cout _ endl; cout ttt请输入操作模式 ttt endl; cout ttt1.管理员 ttt endl; cout ttt2.顾客 ttt endl; cout _ m; if (m = 1) Adm(); int i; cin i; switch (i) case 1:AdmOrder(); break ; case 2:AdmVege(); break ; case 3:AdmSell(); break ; case 4: break ; else client(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 33 页 - - - - - - - - - / 定义管理员登入界面voidFace:Adm() string account, code; while (1) cout _ endl; cout account; cout code; cout _ Adm1(); break ; else cout ttt输入的账户或密码错误 Adm(); / 定义管理员界面voidFace:Adm1() cout _ endl; cout ttt请输入操作: endl; cout ttt1.查找修改删除订单 endl; cout ttt2.菜式和价格的管理 endl; cout ttt3.查看销售情况 endl; cout ttt4.退出 endl; cout _ i; switch (i) case 1:AdmOrder(); break ; case 2:AdmVege(); break ; case 3:AdmSell(); break ; case 4:start(); break ; start(); / 查找修改删除订单voidFace:AdmOrder() cout _ endl; cout ttt请输入操作: endl; cout ttt1.查找订单 endl; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 33 页 - - - - - - - - - cout ttt2.修改订单 endl; cout ttt3.删除订单 endl; cout ttt4.退出 endl; cout _ i; switch (i) case 1:AdmOrderI(); break ; case 2:AdmOrderII(); break ; case 3:AdmOrderIII(); break ; case 4:Adm1(); break ; Adm1(); / 菜式和价格的管理voidFace:AdmVege() cout _ endl; cout ttt请输入操作: endl; cout ttt1.添加菜品 endl; cout ttt2.修改菜品 endl; cout ttt3.删除菜品 endl; cout ttt4.查找菜品 endl; cout ttt5.设置折扣 endl; cout ttt6.退出 endl; cout _ i; switch (i) case 1:AdmVegeI(); break ; case 2:AdmVegeII(); break ; case 3:AdmVegeIII(); break ; case 4:AdmVegeV(); break ; case 5:AdmVegeVI(); break ; case 6:Adm1(); break ; Adm1(); / 查看销售情况voidFace:AdmSell() cout _ endl; cout day; day = D: + day + .txt; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 33 页 - - - - - - - - - OrderMana pe; pe.txtinsertMana(day); cout 订单数 : pe.getFre()endl; cout 销售额 : pe.getBossMoney() endl; cout 外卖和在店销售的占比: pe.getSpec() endl; Adm1(); / 定义客户界面voidFace:client() cout _ endl; cout ttt菜单 endl; cout 菜品名称 t 价格tt 折扣 endl; Menu pe; string number; double money = 0; pe.txtinsert(); pe.printmembers(); cout 请输入购买菜品和份数: Vege; int num; cin num; pe.insert(Vege, num); cout c; if (c = 否) break ; cout ttt请选择消费模式 endl; cout ttt1.外卖 endl; cout ttt2.在店消费 i; if (i = 1) string time, address, phone; cout 请输入送餐时间: time; cout 请输入送餐地点: address; cout 请输入手机号: phone; number = pe.number(); cout ttt外卖 endl; cout ttt编号: number endl; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 33 页 - - - - - - - - - cout 送餐时间 : time t送餐地点 : address t 客户手机号 : phone endl; cout 菜品 tt价格tt份数tt折扣 endl; pe.printord(); list: iterator it; for (it = pe.ord.begin(); it != pe.ord.end(); it+) money = (*it)-getmoney()*(*it)-getnum()*(*it)-getdiscount()*0.1 + money; cout 总价: money + 5 元 endl; shard.txtinsertI(&pe, time, address, phone,number); elseif (i = 2) cout i; bool r = 0; if (i = 是) r = 1; int c; srand( unsigned )time( NULL ); c = rand() % (50 - 1); number = pe.number(); cout ttt在店消费 endl; cout ttt订单编号: number endl; cout 包厢费: ( int )r * 50 元 endl; cout 座位号: c endl; cout 菜品 tt价格tt份数tt折扣 endl; pe.printord(); list: iterator it; for (it = pe.ord.begin(); it != pe.ord.end(); it+) money = (*it)-getmoney()*(*it)-getnum()*(*it)-getdiscount()*0.1 + money; cout 总价: money + (int )r * 50 元 endl; shard.txtinsertII(&pe, r, c, number); start(); / 添加菜品voidFace:AdmVegeI() Menu pe; pe.txtinsert(); string name; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 14 页,共 33 页 - - - - - - - - - double money; double discount; cout name; cout money; cout discount; Vegetalbe b(name, money, discount); pe.pushnew(b); list: iterator it; ofstream outDate(菜单.txt, ios :trunc); for (it = pe.members.begin(); it != pe.members.end(); it+) outDate getname() tt getmoney() tt getdiscount() endl; outDate.close(); cout 添加成功 endl; AdmVege(); / 修改菜品voidFace:AdmVegeII() Menu pe; pe.txtinsert(); string name; double money; double discount; cout name; list: iterator it; for (it = pe.members.begin(); it != pe.members.end(); it+) if (*it)-getname() = name) cout money; cout discount; (*it)-SetVegetalbe(name, money, discount); break ; ofstream outDate(菜单.txt, ios :trunc); for (it = pe.members.begin(); it != pe.members.end(); it+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 15 页,共 33 页 - - - - - - - - - outDate getname() tt getmoney() tt getdiscount() endl; outDate.close(); cout 修改成功 endl; AdmVege(); / 删除菜品voidFace:AdmVegeIII() Menu pe; pe.txtinsert(); string name; cout name; pe.dleinsert(name); list: iterator it; ofstream outDate(菜单.txt, ios :trunc); for (it = pe.ord.begin(); it != pe.ord.end(); it+) outDate getname() tt getmoney() tt getdiscount() endl; outDate.close(); cout 删除成功 endl; AdmVege(); / 查找菜品voidFace:AdmVegeV() Menu pe; pe.txtinsert(); string name; cout name; list: iterator it; for (it = pe.members.begin(); it != pe.members.end(); it+) if (*it)-getname() = name) cout 菜品名称: getname() t 价格: getmoney() 元t getdiscount() 折 endl; break ; AdmVege(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 16 页,共 33 页 - - - - - - - - - / 设置折扣voidFace:AdmVegeVI() Menu pe; pe.txtinsert(); double discount; double money; string name; cout name; list: iterator it; for (it = pe.members.begin(); it != pe.members.end(); it+) if (*it)-getname() = name) cout discount; money = (*it)-getmoney(); (*it)-SetVegetalbe(name, money, discount); break ; ofstream outDate(菜单.txt, ios :trunc); for (it = pe.members.begin(); it != pe.members.end(); it+) outDate getname() tt getmoney() tt getdiscount() endl; outDate.close(); cout 修改成功 endl; AdmVege(); / 查找订单voidFace:AdmOrderI() cout day; day = D: + day + .txt; cout numble; OrderMana pe; pe.txtinsertMana(day); pe.findMana(numble); AdmOrder(); / 修改订单voidFace:AdmOrderII() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 17 页,共 33 页 - - - - - - - - - cout day; day = D: + day + .txt; cout numble; OrderMana pe; pe.txtinsertMana(day); / 删除订单voidFace:AdmOrderIII() cout day; day = D: + day + .txt; cout numble; OrderMana pe; pe.txtinsertMana(day); ofstream outDate(day, ios :trunc); list: iterator it; for (it = pe.ord.begin(); it != pe.ord.end(); it+) if (*it)-getKind() = 外卖) outDate ttt外卖 endl; outDate ttt编号 getNumble() endl; outDate 送餐时间 : getTim() t 送餐地点 : getAddress() t 客户手机号 : getphone() endl; outDate 菜品 tt价格 tt份数tt折扣 endl; list: iterator I; for (I = (*it)-ord.begin(); I != (*it)-ord.end(); it+) outDate getname() tt getmoney() tt getnum()ttgetdiscount() endl; outDate 总价: getAllmoney() 元 endl; else outDate ttt在店消费 endl; outDate ttt订单编号: getNumble() endl; outDate 包厢费: getA() * 50 元 endl; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 18 页,共 33 页 - - - - - - - - - outDate 座位号: getTable() endl; outDate 菜品 tt价格 tt份数tt折扣 endl; list: iterator I; for (I = (*it)-ord.begin(); I != (*it)-ord.end(); it+) outDate getname() tt getmoney() tt getnum() tt getdiscount() endl; outDate 总价: getAllmoney() 元 endl; outDate.close(); cout 删除成功 endl; main.cpp #includevegetalbe.h#includemenu.h#includeorder.h#includeFace.h#includeusingnamespace std; void main() Face re; re.start(); Mana.cpp #includeMana.hMana :Mana( stringnumble, stringkind , stringtim , stringaddress , stringphone) this -Numble = numble; this -kind = kind ; this -tim = tim ; this -address = address ; this -phone = phone; Mana :Mana( stringnumble, stringkind , inttable , boola) this -Numble = numble; this -kind = kind ; this -table = table ; this -a = a; voidMana :setAllmoney(intmoney ) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 19 页,共 33 页 - - - - - - - - - Allmoney = money ; voidMana :insert(stringVege, doublemoney , intnum , doublediscount ) list: iterator it; *it = new Vegetalbe ( Vege , money , num , discount ); ord.push_back(*it); menu.cpp #includemenu.h#include#include#includeusingnamespace std; / 输出原有菜单voidMenu :printmembers() list: iterator it; for (it = members.begin(); it != members.end(); it+) cout getname() tt getmoney() 元tt getdiscount() 折 endl; / 输出顾客菜单voidMenu :printord() list: iterator it; for (it = ord.begin(); it != ord.end(); it+) cout getname() tt getmoney() 元tt getnum() 份tt getdiscount() 折 endl; / 记录顾客挑选菜单voidMenu :insert(stringVege, intnum ) list: iterator it; for (it = members.begin(); it != members.end(); it+) if (*it)-getname() = Vege ) (*it)-setnum(num ); ord.push_back(*it); / 记录原有菜单名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 20 页,共 33 页 - - - - - - - - - voidMenu :txtinsert() ifstream infile(菜单 .txt); string name; double money; double discount; infile name money discount; p = new Vegetalbe (name, money, discount); while (!infile.eof() members.push_back(p); infile name money discount; p = new Vegetalbe (name, money, discount); infile.close(); voidMenu :pushnew( Vegetalbe & b) p = & b; members.push_back(p); stringMenu :number() time_t t = time(0); char tmp32 = NULL ; strftime(tmp, sizeof (tmp), %Y%m%d%H%M%S, localtime(&t); return tmp; voidMenu :dleinsert(stringVege) list: iterator it; for (it = members.begin(); it != members.end(); it+) if (*it)-getname() != Vege ) ord.push_back(*it); voidMenu :insert(stringVege, doublemoney , intnum , doublediscount ) list: iterator it; *it = new Vegetalbe ( Vege , money , num , discount ); ord.pus

    注意事项

    本文(2022年面向对象程序设计A课程设计 .pdf)为本站会员(Q****o)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开