Student_Answers_Chapter_08.doc

  1. 1、本文档共10页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Student_Answers_Chapter_08Student_Answers_Chapter_08

Suggested answer for Exercise 8.1 (a) The instanceOf stereotypes are only shown here for illustration. The fact that the objects are instances of the Position class is already shown in the label of each object. (b) We assume that the counter maintains a single integer value, which is initialized to zero. Set and reset have the same effect, and so are modelled as a single operation, setToZero. (c) An enumeration is used below to specify the possible states of the switch. In this particular case, a Boolean state variable could be used, but defining an enumeration gives greater scope for extensibility. Alternatively, the class interface could be specified without specifying how the state is recorded. (d) An attribute with `many multiplicity is used below to record the set of illuminated lights, using the Colour enumeration illustrated in Figure 8.3. The OCL notation for collection literals has been used to show the values of this attribute in the object icon. Suggested answer for Exercise 8.2 (a) A person can have zero or more books out on loan, and each book can be borrowed by at most one person at any given time. (b) A person can have read many books, and each book may have been read by many people. (c) A piece can only occupy one square at a time, and if it has been captured, it occupies no square. Each square can have at most one piece on it. If the aim is to model only pieces on the board, the multiplicity at the right of this association should be `exactly 1. (d) The multiplicities below refer to who is married to whom at a given time, assuming no polygamy or polyandry. As the spouse relation is symmetric, it can simply be labelled with an association name. (e) A person can have zero or more children, but each person has exactly two (biological) parents. This relation is not symmetric, so adding role names makes the intended interpretation clearer. Suggested answer for Exercise 8.7 The job titles and salaries can most naturally be mo

文档评论(0)

cxiongxchunj + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档