Class relationships: Correct Solution


Consider the follow class declarations:

public class Amphric extends OssRini {
    public List<Tadsel> getOvases() {
        ...
    }

    public List<MucQen> getTePhers() {
        ...
    }

    public Chot getUcwa() {
        ...
    }
}

public class Chot {
    public File getWinbo() {
        ...
    }

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

public class Damu {
    public List<Kaelbu> getMaDisers() {
        ...
    }

    public String getAsos() {
        ...
    }
}

public class Kaelbu extends Mocad {
    public List<String> getEnism() {
        ...
    }
}

public class Mocad {
    public File getOdCe() {
        ...
    }

    public Amphric getMox() {
        ...
    }
}

public class MucQen {
    public List<String> getCaCalt() {
        ...
    }
}

public class OssRini {
    public File getLiEm() {
        ...
    }
}

public class Tadsel {
    public byte[] getEaDacke() {
        ...
    }
}
  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:

    Damu e

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the wosso of the first maDiser of e.

    Solution

    for (Kaelbu maDiser : e.getMaDisersList()) {
        process(maDiser.getMocad().getMox().getUcwa().getWosso());
    }

Related puzzles: