资源预览内容
第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
亲,该文档总共3页全部预览完了,如果喜欢就下载吧!
资源描述
Suggested answer for Exercise 2.1The class diagram is shown below. Note the following: 1. Fields in the Java classes that store references to other objects are shown in UML as associations between the classes, not as attributes. 2. The cost function in the Component class is abstract: this is shown in UML by writing it in an italic font, as with the class itself.Suggested answer for Exercise 2.2(a) The diagram below uses the names of the variables in the code as object names. Although this probably clarifies the current example, it runs the risk of confusing the two distinct concepts of object name and variable name. This is potentially dangerous in an environment where objects are reassigned to different variables. This diagram illustrates the different numbers of part objects that can exist for a catalogue entry: zero, one or many. (b) Apart from the assembly object, all the objects in this diagram have already appeared in the answer to part (a). (c) A client object has been added in this diagram, shown as sending the initial cost message to the assembly.
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号