江苏开放大学NET平台与C#程序设计第四次形考作业_第1页
江苏开放大学NET平台与C#程序设计第四次形考作业_第2页
江苏开放大学NET平台与C#程序设计第四次形考作业_第3页
江苏开放大学NET平台与C#程序设计第四次形考作业_第4页
江苏开放大学NET平台与C#程序设计第四次形考作业_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

江苏开放大学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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论