Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,584 members, 7,809,114 topics. Date: Thursday, 25 April 2024 at 11:42 PM

Ooad With Uml - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Ooad With Uml (888 Views)

Test Case Generation From UML Diagrams In Java Code / UML Or ORM Model? / UML (2) (3) (4)

(1) (Reply)

Ooad With Uml by 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.
Re: Ooad With Uml by Beaf: 7:13pm On Jul 02, 2010
Its much easier than you think! wink

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)

10 Programming Languages That Could Shake The World / 14 Programming Communities For Developers, Hackers / Introduction To Basic Terminal Commands For Linux

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.