ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:260.29KB ,
资源ID:27836868      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

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

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(自动售货机需求报告.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

自动售货机需求报告.docx

1、自动售货机需求报告Vending Machine1 - ObjectivesThe objectives of this exercise are to: Based on TOOD design approach, propose 2 solutions for the design architecture of the Vending Machine presented in specification module: First solution: sequential - without process.Using a sequential solution, it is inter

2、esting to show than one mode of the State Transition Diagram (STD) cannot be reached: “Dispensing Product”. Second solution: concurrent - with process(es).Hypothesis must be made on the hardware.2 - Problem OverviewThis example is an extension of the problem presented at the Forum ”Structured Develo

3、pment” in San Francisco, in February 1986.The problem statement and the resulting models were interactively developed and described as a dialogue between the customer and the analyst.The customer started by outlining to the analyst that he is faced with crooks as customers who try putting junk into

4、the coin slots of his vending machines hoping to get something for nothing. Some even try to enter coin-like slugs to fool the machines. They also try to vandalize the selection register to get products free. These are major problems for the vending machine operators because they do business on a na

5、rrow margin, which disappears very quickly. The machine is to do the following:- Accept objects from the customer in payment for his/her purchase.- Check each object to make sure that it is not a slug. This is to be done by validating the size, weight and thickness.- Accept nickels, dimes and quarte

6、rs. Any other coins are to be treated as slugs and returned to the customer.- Only initiate payment computation or product selection process after a validated coin is detected.- Accept product selection from the customer.- Check to see whether the selected product is available, if not available, ret

7、urn coins automatically and notify customer.- Accept a variety of products, which will change from time to time. Hence, the product prices should be changeable.- Return the customers payment on request if he or she decides not to make a selection.- Dispense the product to the customer if it is avail

8、able and the amount is sufficient.- Return the correct change to the customer if the amount deposit is greater than the product price (initial conditions ?).- Disable the product selection after the product is dispensed and until the next validated coin is received.Several extra requirements could b

9、e added to the first list of users requirements, since we identified silences:- Reject coins as slug during the product is dispensed.- Have available coins to be able to give back the change (initial conditions). For that, the coins introduced by the customer are accumulated in the coins storage (An

10、yway we dont know if the inserted coins are used for giving back the change or not).- Tolerance for validating the thickness, size & weight (doesnt have effect on the architecture nor on the algorithms.- Reject coins as slug if there is not enough change and of course doesnt deliver the product (do

11、we have the information from the hardware).- Reject coins as slug if there is no space enough in the receiving box (do we have the information from the hardware).3 - Proposed context diagramSince no information on the hardware is available, the following context diagram is proposed (as functional di

12、agram; no low level exchanges). 3 different terminators are proposed:- COINS SYSTEM: the system for processing the objects and containing the coins container,- SELECTOR: the interface for the customers actions and notifications,- PRODUCT DISPENSER: the box containing the products.Since there is no i

13、ndication of the initial number of products from the PRODUCT DISPENSER and the initial number of coins from the COINS SYSTEM, assumptions must be made regarding the limit and initial conditions. These values are defined by compilation (#define of C).- Each valid object is sent directly to the change

14、 coins storage (if space available) and will be used as change coin.- One change storage is available for each type of coin and full as soon as the vending machine is turned on. The maximum value is MaxNbOfCoin, same for every storage.- The number of type of product is defined by MaxTypeOfProducts a

15、nd the maximum number of product for one type is defined by MaxNbOfProducts.- As soon as the Vending Machine is turned on, the product storage is considered full for all products (type and number for 1 type).- The data flow called slug is in fact a control flow because an even to the terminator COIN

16、S SYSTEM.Recall of the State Transition Diagram4 - Identification of objects and classes4.1 ClassesFrom the text before and the global SART model presented in specification, the following objects, classes and functions can be proposed.Entity NameAttributesTypeObjectThickness (integer)Size (integer)W

17、eight (integer)T_ObjectCoinObjectValueTypeT_CoinPaymentPaymentIntegerProductIdentifierPrice (integer)T_ProductModeModeT_Mode4.2 InstantiationThe instantiation of a class becomes an object. In the case of the vending machine there are:Coins storage = multiple instantiation of the class Coin,Products

18、storage = multiple instantiation of the class Product,CurrentPayment = single instantiation of the class Payment,CurrentMode = single instantiation of the class Mode.4.3 External interfaces1 terminator is translated in 1 TOOD entity such as machine, sub-application or process. In the case of the SAR

19、T diagram above, 3 machines are identified.5 - FunctionalityEntitiesFunction (methods)ParametersCoins- Validate- Input = object- output = Value, status (coin or slug)- Accumulate- Input : Coin- Output : status (full)- ReturnCoins- input : Change- Output : Status (enough, not enough)Payment- Accumula

20、te- Input : CoinValue- Output : none- Get- Input : none- Output : Payment- Clear- Input : none- Output : none- Validate- Input : ProductPrice- Output : Status (enough)Products- Dispense- Input : Valid Selection- Output : Status (OK/NOK)- GetPrice (Validation)- Input: Selection- Output: Price, Status

21、 (OK/NOK)Mode(Contained in the main controller)ADT_Object- Initialize(Question for the students why ?)- Input : Thickness, Size, Weight- Output : Object- IsEqual- Input : Object 1, Object 2- Ouput : Status (Equal/Not Equal)ADT_Coin- GetValue- Input : Coin- Output : Value- Validate- Input: Object, -

22、Output:6 - First Proposed solution : sequential caseNote: The proposed solution here after is not the only one possible. Several solutions exist, and the designer has to choose the best one regarding the encapsulation, abstraction, Especially, the process of thinking makes us begin with the research

23、 of the most elementary objects before grouping them.The process is bottom-up.6.1 ArchitectureFigure 1: Application Architecture2 sub-applications appear: Coins & Products.The sub-application “Coins” is very big compared to “Products” and to the machines SELECTOR & Payment. But the grouping of relat

24、ed entities such as object, coins, terminator coins system obliges the designer to choose this solution. Of course the balance of the design must also be studied and other solutions can be proposed. Justifications must then be given (work sharing for example).The sub-application “Products” contains

25、only 2 entities that are a machine for the storage and an ADT for the type product. With TOOD, we could have only one machine for “Products” defining both the storage and the type (see the GDL TOOD). But, if we take the case of the C+ language, it requires absolutely first the definition of the clas

26、s and second the instantiation(s) of this class. And anyway the translation from SART to TOOD proposes to translate data flows into Abstract Data Types.Note: For the entity “Products”, the function “Validate” returns the price of the selected product. A function could exist (“GetPrice”) to get this

27、value. It can be easier to understand.Note: Another solution is to group all the external interfaces within 1 entity to make easier the maintenance and better the portability.6.2 Machine MODE Interfaces & EnvironmentIt is not necessary to draw again the diagram because it would be very close to Figu

28、re1.6.3 Sub-application “Coins”6.3.1 Interfaces & Environment6.3.2 Body of the sub-applicationThe body of this sub-application is related to detailed design, every entity composing the sub-application being a basic one.ADT_Object is used by ADT_Coin (via “IsEqual”) and COINS SYSTEM (via “Initialise”

29、). The question “Why do we need this function?” can be asked to the students.6.4 Sub-Application “Products”6.5 Machines “Payment” & “SELECTOR”We dont know the interfaces of the SELECTOR.The questions that can be asked are: Is it possible to read without wait the selection? What is the hardware for t

30、he users lamp (not available), time out , on/off?6.6 Main Algorithm/* Proposal of Algorithm for the main() */Mode = Wait_For_CoinPayment.Clear()while (true) do wait 1 second Not really necessary in that case because the CPU is dedicated to thevending machineif (GetValue(Out Value) = OK)| Payment.Acc

31、umulate (In Value)| Mode = Wait_For_Selectionendif if (SELECTOR.AcceptSelection(Out Selection) = true) | if (Mode != Wait_For_Selection) do nothing | else | | if (Products.GetPrice (In Selection, Out Price) = AVAILABLE) | | if (Payment.Validate (In Price, Out Change) = OK) | | if (Coins.ReturnCoins (In Change) = OK) | | Mode = Dispensing_Product | | Product.Dispense (In ValidSelection) /* Returned status not used */ | | else | | Payment.Get (Out CurrentPayment) | | Coins.ReturnCoins (In CurrentPayment) | | endif | | Payment.Clear() | | Mode =

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1