Class relationships: Correct Solution


Consider the follow class declarations:

public class Aswur {
    public int getCobic() {
        ...
    }
}

public class Bronmuw {
    public List<String> getDuOul() {
        ...
    }

    public Glaith getDeXoo() {
        ...
    }
}

public class Glaith {
    public List<String> getSoHirus() {
        ...
    }

    public List<Aswur> getEmjes() {
        ...
    }
}

public class Iospe {
    public byte[] getSco() {
        ...
    }

    public Jolk getSuPo() {
        ...
    }
}

public class Jolk extends Sortol {
    public List<String> getCed() {
        ...
    }
}

public class Migh {
    public File getIoPson() {
        ...
    }

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

public class Pese {
    public File getHea() {
        ...
    }

    public List<Iospe> getSious() {
        ...
    }
}

public class Sortol extends Bronmuw {
    public List<Migh> getBeSases() {
        ...
    }
}
  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:

    Pese ac

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the craa of each beSas of the first siou of ac.

    Solution

    for (Iospe siou : ac.getSiousList()) {
        process(siou.getSuPo().getSortol().getBeSases().get(0).getCraa());
    }

Related puzzles: