Self-Learning Module

Outcomes Covered


UML [9:04]


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)