7. exercise: UML
- Review presentation
- Investigate org.activity07 package
Installand graphical editors:sudo apt-get install dia calligraflow
and investigate how to use them for different diagrams.
- Download and extract it
- Install plugin
- Draw UML diagram from org.activity07 package (excluding ..Test.. classes)
- Export class diagram to Animals.png file in the same package
- Implement methods of necessary classes to pass unit tests
Create classes and implement methods
Use GreenUML to create a class diagram for Animal, Mammal, Bird, Dog, Hawk classes.
Also generate getters and setters for class properties.
- Create class Animal.
- Add private field int age;
- Add public method void setAge(int age), which allow to set only non-negative number;
- Add public method int getAge();
- Create class Mammal, which extends Animal.
- Add private field boolean isDomestic;
- Add public method void setIsDomestic(boolean isDomestic);
- Add public method boolean getIsDomestic();
- Create class Bird, which extends Animal.
- Add private field boolean canFly.
- Add public method void setCanFly(boolean canFly);
- Add public method boolean getCanFly();
- Create class Dog, which extends Mammal.
- Add private field String name;
- Add public method void setName(String name), which allow to set only name with letters, starting with capital letter;
- Add public method String getName();
- Create class Hawk, which extends Bird.
- Add private field String color;
- Add public method void setColor(String color);
- Add public method String getColor();
- Export created class diagram with all mentioned classes in file Animals.png and save it into ...activity07 package.
- — how to use UML
- — UML described with UML itself
Other modeling tools
- plugin for Eclipse Modeling Tools
Other UML editors