Self-Learning Module
Outcomes Covered
UML
- Correctly annotate and interpret fields (name and type) on a class diagram
- Correctly annotate and interpret methods (with arguments and return type) on a class diagram
- Use visibility modifiers to denote the visibility of a field or method
UML [9:04]
- Read Appendix 7 skipping the "UML Activity Diagrams" section of the textbook.
- Study the boxes in Figure A7.4 (for now, don't worry about the arrows between the boxes).
- Watch the following video [link]
Activity
Draw the UML diagram for the Rectangle
class below. You can draw this on paper
and submit a picture of it in Canvas or use a tool on your computer and submit
the result in Canvas.
/**
* Simple example Class that represents a Rectange
*/
public class Rectangle {
private String color;
private final int height;
private final int width;
private final int area;
public Rectangle(int height, int width) {
this.height = height;
this.width = width;
area = height*width;
}
public int getHeight() {
return height;
}
public String getColor() {
return color;
}
public String setColor(String color) {
String oldColor = this.color;
this.color = color;
return oldColor;
}
public int getArea() {
return area;
}
}
Bonus Material (optional)
- Dr. Taylor on Time of Day [2:25] [link]