Class relationships: Correct Solution


Consider the follow class declarations:

public class Modme {
    public int getCidke() {
        ...
    }

    public List<Sprecktast> getOlbuis() {
        ...
    }
}

public class Prerel {
    public int getSti() {
        ...
    }

    public Prii getDiten() {
        ...
    }
}

public class Prii {
    public List<String> getEpin() {
        ...
    }
}

public class Silasm extends Wazois {
    public Modme getQebod() {
        ...
    }
}

public class Sprecktast {
    public String getCice() {
        ...
    }

    public byte[] getEese() {
        ...
    }
}

public class Strundce extends Zuan {
    public String getPhe() {
        ...
    }
}

public class Wazois {
    public File getPonbo() {
        ...
    }
}

public class Zuan extends Prerel {
    public List<Silasm> getVoPibis() {
        ...
    }
}
  1. Draw a diagram showing the class relationships.

    You only need to diagram the classes listed above. You only need to show the name of each class; do not show their methods or properties.

    Draw arrows between the classes that have relationships, and label each arrow with one of the following:

    Make sure your arrows point in the correct direction!

    Solution

  2. Given the following variable:

    Strundce wo

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the eese of the first olbui of each voPibi of wo.

    Solution

    for (Sprecktast olbui : wo.getZuan().getVoPibis().get(0).getQebod().getOlbuisList()) {
        process(olbui.getEese());
    }

Related puzzles: