版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
江苏开放大学NET平台与C#程序设计第四次形考作业实验名称:一、实验目的及要求1.使用文本框、按钮、标签、复选框、单选按钮等控件2.查找和修正语法错误二、实验内容1.设计与演示普通自助用餐费用预算功能的实现2.设计与演示宴会用餐费用预算功能的实现三、实验设备及环境1.安装visualstudio2010软件四、实验步骤(功能实现的核心代码及说明)本实验以综合实验讲义中的案例作为本次形考作业,任务一:实现启动“订餐小精灵”的设计设计与开发,实现普通自助用餐费用预算功能,程序运行默认状态图、改变选项值后的效果图、用餐人数为50的程序运行效果图、当前输入用餐人数超过40人时的程序运行效果图把实验的相关代码复制到word文档中,并把代码运行的相关运行结果图截屏存放在代码的下面。usingSystem;publicclassCustomer{publicstringcustomerName;//姓名publicboolmemberOption;//是否会员publicstringphoneNumber;//联系电话publicvoidSetMemberOption(booloption){memberOption=option;}}usingSystem;usingSystem.Windows.Forms;publicclassDinner{publicconststringtype=“自助用餐”;//用餐类型publicconstintcostOfFoodPerPerson=35;//人均食品费用publicdecimalcostOfBeveragesPerPerson;//人均饮料费用publicCustomercustomer;//客户publicDateTimedate;//日期时间privatedecimalcost;//总费用publicdecimalCost{get{returncost;}set{cost=value;}}privateintnumberOfPeople;//用餐人数publicintNumberOfPeople{get{returnnumberOfPeople;}set{if(value>40){MessageBox.Show(“超过40人,无法下订单”);return;}else{numberOfPeople=value;}}}publicDinner(intnumberOfPecple){customer=newCustomer();this.numberOfPeople=numberOfPecple;//初始化人数为5}publicvoidSetWineOption(boolwineOption){//人均饮料费if(wineOption){costOfBeveragesPerPerson=40.00M;}else{costOfBeveragesPerPerson=15.00M;}}publicdecimalCalculateCost()//返回总费用{decimaltotalCost=(costOfFoodPerPerson+costOfBeveragesPerPerson)*numberOfPeople;if(customer.memberOption){this.cost=totalCost*0.85M;returntotalCost*0.85M;}else{this.cost=totalCost;returntotalCost;}}}usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespaceSpiritKitchen{publicpartialclassSpiritKitchen:Form{Dinnerdinner;publicSpiritKitchen(){InitializeComponent();dinner=newDinner((int)dinnerNumericUpDown.Value);dinner.SetWineOption(dinnerWinerCheckBox.Checked);//人均饮料费用DisplayDinnerCost();//总费用}privatevoidDisplayDinnerCost(){decimalCost=dinner.CalculateCost();CostLabel.Text=Cost.ToString(“c”);}privatevoiddinnerNumericUpDown_ValueChanged(objectsender,EventArgse){dinner.NumberOfPeople=(int)dinnerNumericUpDown.Value;//设置用餐人数DisplayDinnerCost();//总费用}privatevoiddinnerMemberCheckBox_CheckedChanged(objectsender,EventArgse){dinner.customer.SetMemberOption(dinnerMemberCheckBox.Checked);//设置客户是否为会员DisplayDinnerCost();//总费用}privatevoiddinnerWinerCheckBox_CheckedChanged(objectsender,EventArgse){dinner.SetWineOption(dinnerWinerCheckBox.Checked);//设置是否饮用酒水DisplayDinnerCost();//总费用}privatevoidcancaBbutton_Click(objectsender,EventArgse){Close();}}}usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespaceSpiritKitchen{staticclassProgram{///<summary>///应用程序的主入口点。///</summary>[STAThread]staticvoidMain(){Application.EnableVisualStyles();Applica
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 临床膝关节前交叉韧带损伤护理
- 客户决策流程
- 大创赛教育维度实践路径探索
- 锦城教育课件
- 汽车维护课程设计
- 2026低钾血症的护理解读
- 冬至班队活动课
- 课件制作平台分析
- 老年医学科骨质疏松预防措施
- 锦瑟教案设计
- 国资委安全生产十条硬措施
- 营养护理专科试题题库及答案解析
- 医院建设项目设计技术方案投标文件(技术方案)
- EPC项目施工图设计质量控制措施
- AMS成就动机量表问卷计分解释
- 大专求职简历模板8篇
- 2023年06月河北唐山市事业单位(滦南县)公开招聘570人笔试题库含答案解析
- 股权转让协议承诺书
- 正压式空气呼吸器使用
- 铁塔公司基站外市电基础知识
- 1年级-一年级数独100题-20160904-数学拓展
评论
0/150
提交评论