ImageVerifierCode 换一换
格式:DOC , 页数:72 ,大小:1.16MB ,
资源ID:4581557      下载积分:5 金币
验证码下载
登录下载
邮箱/手机:
验证码: 获取验证码
温馨提示:
支付成功后,系统会自动生成账号(用户名为邮箱或者手机号,密码是验证码),方便下次登录下载和查询订单;
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/4581557.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  
声明  |  会员权益     获赠5币     写作写作

1、填表:    下载求助     索取发票    退款申请
2、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
3、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
4、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
5、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前自行私信或留言给上传者【二***】。
6、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
7、本文档遇到问题,请及时私信或留言给本站上传会员【二***】,需本站解决可联系【 微信客服】、【 QQ客服】,若有其他问题请点击或扫码反馈【 服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【 版权申诉】”(推荐),意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:4008-655-100;投诉/维权电话:4009-655-100。

注意事项

本文(2023年面向对象程序设计实验指导书.doc)为本站上传会员【二***】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4008-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

2023年面向对象程序设计实验指导书.doc

1、面向对象程序设计实验指导书宋航 刘国奇东北大学软件学院2023.9目 录面向对象程序设计0实验指导书0前 言2实验规定3Experiment 1 Implementing the Collections in the Gourmet Coffee System(4 Hours)4Background4Description4Files12Tasks13Experiment 2 Using Design Patterns in the Gourmet Coffee System(4 Hours)16Background16Description16Files23Tasks23Experiment

2、 3 Using File I/O in the Gourmet Coffee System(4 Hours)26Background26Description26Files31Tasks32Experiment 4 Implementing a GUI for the Gourmet Coffee System(4 Hours)35Background35Description35Files38Tasks39前 言面向对象的思想可以渗透到需求分析、系统建模、体系结构设计、程序设计与实现、系统测试等多个方面,它是描述现实世界复杂对象的相称直接并且直观的有效手段,对于提高系统质量、开发效率和代码

3、重用率,都有明显的效果。面向对象程序设计课程是软件工程专业的重要专业基础课程之一,该门课程注重实践性和实用性,重要通过面向对象程序设计思想和Java语言结合起来,让学生掌握面向对象程序设计思想,以及纯熟使用Java语言进行面向对象的编程,因此学生不能满足于只听懂老师讲授的课堂内容,看懂书上的程序,应将课堂教学与实践环节紧密结合,使得学生加深对讲授内容的理解,学会上机调试程序。也就是善于发现程序中的错误,并且能不久地排除这些错误,使程序能对的运营。面向对象程序设计是结合卡耐基梅隆大学的SSD3而形成的课程,该课程的教学体系和实验体系都很完整,并且东北大学软件学院也提供了良好的教学实验环境,希望同

4、学们可以充足运用实验条件,认真完毕实验,从实验中得到应有的锻炼和培养。希望同学们在使用本实验指导书及进行实验的过程中,可以帮助我们不断地发现问题,并提出建议,使面向对象程序设计真正可以帮助同学们学习。实验规定面向对象程序设计课程实验的目的是为了使学生在课堂学习的同时,通过一系列的实验,使学生加深了解和更好地掌握面向对象程序设计课程教学大纲规定的内容。在面向对象程序设计的课程实验过程中,规定学生做到:(1)预习实验指导书有关部分,认真做好实验内容的准备,就实验也许出现的情况提前作出思考和分析。(2)仔细观测调试程序过程中出现的各种问题,记录重要问题,作出必要说明和分析。(3)遵守机房纪律,服从辅

5、导教师指挥,爱惜实验设备。(4)实验课程不迟到,如有事不能出席,所缺实验一般不补。(5)本实验采用的开发环境为Eclipse,同学在做实验之前规定熟悉该集成开发环境。 Experiment 1 Implementing the Gourmet Coffee System(4 Hours)Prerequisites, Goals, and OutcomesPrerequisites: Before you begin this exercise, you need mastery of the following: Object Oriented Programming o Knowledge

6、of class design Class attributes Constructors Accessor methods Mutator methods o Knowledge of inheritance How to implement a specialization/generalization relationship using inheritance Goals: Reinforce your ability to implement Java classes using inheritance. Outcomes: You will demonstrate mastery

7、of the following: Implementing the constructors, accessors, and mutators of a Java class Using inheritance to implement a specialization/generalization relationship Background This assignment asks you to implement some of the classes in the Gourmet Coffee System specified on Exercise 2.DescriptionIn

8、 this assessment, you will implement the classes and relationships illustrated in the following class diagram:Figure 1 Portion of Gourmet Coffee System class diagramThe class specifications are as follows:Class ProductThe class Product models a generic product in the store.Instance variables: code.

9、The unique code that identifies the product description. A short description of the product price. The price of the product Constructor and methods: public Product(String initialCode, String initialDescription, double initialPrice)Constructor that initializes the instance variables code, description

10、, and price. public String getCode(). Returns the value of instance variable code. public String getDescription(). Returns the value of instance variable description. public double getPrice(). Returns the value of instance variable price. boolean equals(Object object). Overrides the method equals in

11、 the class Object. Two Product objects are equal if their codes are equal. String toString(). Overrides the method toString in the class Object. Returns the string representation of a Product object. The String returned has the following format: code_description_priceThe fields are separated by an u

12、nderscore ( _ ). You can assume that the fields themselves do not contain any underscores.Class CoffeeThe class Coffee models a coffee product. It extends class Product.Instance variables: origin. The origin of the coffee roast. The roast of the coffee flavor. The flavor of the coffee aroma. The aro

13、ma of the coffee acidity. The acidity of the coffee body. The body of the coffee Constructor and methods: public Coffee(String initialCode, String initialDescription, double initialPrice, String initialOrigin, String initialRoast, String initialFlavor, String initialAroma, String initialAcidity, Str

14、ing initialBody)Constructor that initializes the instance variables code, description, price, origin, roast, flavor, aroma, acidity, and body. public String getOrigin(). Returns the value of instance variable origin. public String getRoast(). Returns the value of instance variable roast. public Stri

15、ng getFlavor(). Returns the value of instance variable flavor. public String getAroma(). Returns the value of instance variable aroma. public String getAcidity(). Returns the value of instance variable acidity. public String getBody(). Returns the value of instance variable body. String toString().

16、Overrides the method toString in the class Object. Returns the string representation of a Coffee object. The String returned has the following format: code_description_price_origin_roast_flavor_aroma_acidity_bodyThe fields are separated by an underscore ( _ ). You can assume that the fields themselv

17、es do not contain any underscores.Class CoffeeBrewerClass CoffeeBrewer models a coffee brewer. It extends class Product.Instance variables: model. The model of the coffee brewer waterSupply. The water supply (Pour-over or Automatic) numberOfCups. The capacity of the coffee brewer Constructor and met

18、hods: public CoffeeBrewer(String initialCode, String initialDescription, double initialPrice, String initialModel, String initialWaterSupply, int initialNumberOfCups)Constructor that initializes the instance variables code, description, price, model, waterSupply, and numberOfCups. public String getM

19、odel(). Returns the value of instance variable model. public String getWaterSupply(). Returns the value of instance variable waterSupply. public int getNumberOfCups(). Returns the value of instance variable numberOfCups. String toString(). Overrides the method toString in the class Object. Returns t

20、he string representation of a CoffeeBrewer object. The String returned has the following format: code_description_price_model_waterSupply_numberOfCupsThe fields are separated by an underscore ( _ ). You can assume that the fields themselves do not contain any underscores.Class OrderItemClass OrderIt

21、em models an item in an order. Instance variables: product. This instance variable represents the one-way association between OrderItem and Product. It contains a reference to a Product object. quantity. The quantity of the product in the order. Constructor and methods: public OrderItem(Product init

22、ialProduct, int initialQuantity)Constructor that initializes the instance variables product and quantity. public Product getProduct(). Returns the value of the instance variable product, a reference to a Product object. public int getQuantity(). Returns the value of the instance variable quantity. p

23、ublic void setQuantity(int newQuantity). Sets the instance variable quantity to the value of parameter newQuantity. public double getValue(). Returns the product of quantity and price. String toString(). Overrides the method toString in the class Object. Returns the string representation of an Order

24、Item object. The String representation has the following format: quantity product-code product-priceThe fields are separated by a space. You can assume that the fields themselves do not contain any spaces.Test driver classesComplete implementations of the following test drivers are provided in the s

25、tudent archive. Use these test drivers to verify that your code works correctly. Class TestProduct Class TestCoffee Class TestCoffeeBrewer Class TestOrderItem FilesThe following files are needed to complete this assignment: student-files.zip Download this file. This archive contains the following: o

26、 TestProduct.java o TestCoffee.java o TestCoffeeBrewer.java o TestOrderItem.java Tasks Implement classes Product, Coffee, CoffeeBrewer, and OrderItem. Document using Javadoc and follow Suns code conventions. The following steps will guide you through this assignment. Work incrementally and test each

27、 increment. Save often. 1. Extract the files by issuing the following command at the command prompt: C:unzip student-files.zip 2. Then, implement class Product from scratch. Use TestProduct driver to test your implementation. 3. Next, implement class Coffee from scratch. Use TestCoffee driver to tes

28、t your implementation. 4. Then, implement class CoffeeBrewer from scratch. Use TestCoffeeBrewer driver to test your implementation. 5. Finally, implement class OrderItem from scratch. Use TestOrderItem driver to test your implementation. SubmissionUpon completion, submit only the following:1. Produc

29、t.java 2. Coffee.java 3. CoffeeBrewer.java 4. OrderItem.java Experiment 2 Implementing the Collections in the Gourmet Coffee System (4 Hours) Prerequisites, Goals, and OutcomesPrerequisites: Before you begin this exercise, you need mastery of the following: Collections o Use of class ArrayList o Use

30、 of iterators Goals: Reinforce your ability to implement classes that use collections Outcomes: You will demonstrate mastery of the following: Implementing a Java class that uses collections Background In this assignment, you will implement the classes in the Gourmet Coffee System that use collectio

31、ns.DescriptionThe following class diagram of the Gourmet Coffee System highlights the classes that use collections:Figure 2 Gourmet Coffee System class diagramComplete implementations of the following classes are provided in the student archive: Coffee CoffeeBrewer Product OrderItem GourmetCoffee In

32、 this assignment, you will implement the following classes: Catalog Order Sales GourmetCoffee The class specifications are as follows:Class CatalogThe class Catalog models a product catalog. This class implements the interface Iterable to being able to iterate through the products using the for-each

33、 loop.Instance variables: products An ArrayList collection that contains references to instances of class Product. Constructor and public methods: public Catalog() Creates the collection products, which is initially empty. public void addProduct(Product product) Adds the specified product to the col

34、lection products. public Iterator iterator() Returns an iterator over the instances in the collection products. public Product getProduct(String code) Returns a reference to the Product instance with the specified code. Returns null if there are no products in the catalog with the specified code. pu

35、blic int getNumberOfProducts() Returns the number of instances in the collection products. Class OrderThe class Order maintains a list of order items. This class implements the interface Iterable to being able to iterate through the items using the for-each loop.Instance variables: items An ArrayLis

36、t collection that contains references to instances of class OrderItem. Constructor and public methods: public Order() Creates the collection items, which is initially empty. public void addItem(OrderItem orderItem) Adds the specified order item to the collection items. public void removeItem(OrderIt

37、em orderItem) Removes the specified order item from the collection items. public Iterator iterator() Returns an iterator over the instances in the collection items. public OrderItem getItem(Product product) Returns a reference to the OrderItem instance with the specified product. Returns null if the

38、re are no items in the order with the specified product. public int getNumberOfItems() Returns the number of instances in the collection items. public double getTotalCost() Returns the total cost of the order. Class SalesThe class Sales maintains a list of the orders that have been completed. This c

39、lass implements the interface Iterable to being able to iterate through the orders using the for-each loop.Instance variables: orders An ArrayList collection that contains references to instances of class Order. Constructor and public methods: public Sales() Creates the collection orders, which is i

40、nitially empty. public void addOrder(Order order) Adds the specified order to the collection orders. public Iterator iterator() Returns an iterator over the instances in the collection orders. public int getNumberOfOrders() Returns the number of instances in the collection orders. Class GourmetCoffe

41、eThe class GourmetCoffee creates a console interface to process store orders. Currently, it includes the complete implementation of some of the methods. The methods displayNumberOfOrders and displayTotalQuantityOfProducts are incomplete and should be implemented. The following is a screen shot of th

42、e interface:Figure 3 Execution of GourmetCoffeeInstance variables: catalog A Catalog object with the products that can be sold. currentOrder An Order object with the information about the current order. sales A Sales object with information about all the orders sold by the store. Constructor and pub

43、lic methods: public GourmetCoffeeSolution() Initializes the attributes catalog, currentOrder and sales. This constructor is complete and should not be modified. public void displayCatalog Displays the catalog. This method is complete and should not be modified. public void displayProductInfo() Promp

44、ts the user for a product code and displays information about the specified product. This method is complete and should not be modified. public void displayOrder() Displays the products in the current order. This method is complete and should not be modified. public void addModifyProduct() Prompts t

45、he user for a product code and quantity. If the specified product is not already part of the order, it is added; otherwise, the quantity of the product is updated. This method is complete and should not be modified. public void removeProduct() Prompts the user for a product code and removes the spec

46、ified product from the current order. This method is complete and should not be modified. public void saleOrder() Registers the sale of the current order. This method is complete and should not be modified. public void displayOrdersSold() Displays the orders that have been sold. This method is complete and

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服