NewStats: 3,261,356 , 8,173,771 topics. Date: Wednesday, 28 May 2025 at 11:28 PM z554j6z3e3g |
Ooad With Uml (933 Views)
(1) (Reply)
emeka88(m): 6:25pm On Jul 02, 2010 |
Hey guys while studying, I came across this practice question on object oriented analysis and design with UML. A computer game consists of several players who compete with each other to build a beetle. A complete beetle has two antennae, a head, a neck, a body, six legs and a tail. When a player’s beetle is complete that player’s name is displayed and he leaves the game. The game continues until each player’s beetle is completed. The rules of the game are that a beetle: • cannot have an antennae unless it has a head • cannot have a head unless it has a neck • cannot have a neck until it has a body • cannot have a leg unless it has a body and • cannot have a tail until it has a body During the game, each player takes it in turn to be given a random number representing the throw of a die with which to construct his beetle. An integer in the range 1 to 6 represents an antennae, head, neck, body, leg and tail respectively. There should also be a display of the configuration of a player’s beetle before and after his turn. Construct a model for the game. |
Beaf: 7:13pm On Jul 02, 2010 |
Its much easier than you think! ![]() The following are all classes; 1. Beetle 2. Antennae 3. Head 4. Neck 5. Body 6. Leg Tail might be a property only, since it has no properties itself. However, I would tend toward making it a class, because a tail is expected to have methods, eg "wag". With the info below, you can build a class diagram; Beetle has a nullable property called Body. Body has a properties; Antennae, Head, Neck, Body, Leg and Tail. Now that you have your definitions, build an Activity Diagram with; Weave in the conditionalities that make up the rules of the game; . . . a beetle: • cannot have an antennae unless it has a head • cannot have a head unless it has a neck • cannot have a neck until it has a body • cannot have a leg unless it has a body and • cannot have a tail until it has a body All other diagram types should be fairly straightforward after your Class and Activity Diagrams have been built. |
(1) (Reply)
What Chapters Or Topics Should I Focus On Learning Python For Me. Non Programmer
(Go Up)
Sections: How To . 12 Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or s on Nairaland. |