Class relationships: Correct Solution


Consider the follow class declarations:

public class Afton extends Stal {
    public List<Pord> getOruds() {
        ...
    }

    public List<String> getCacbo() {
        ...
    }
}

public class Crellhe {
    public List<Emas> getOcTrerms() {
        ...
    }

    public Vocbri getFlio() {
        ...
    }
}

public class Dili {
    public List<String> getTisse() {
        ...
    }
}

public class Efirm {
    public List<String> getSpon() {
        ...
    }

    public OssVio getCint() {
        ...
    }
}

public class Emas extends EmiOusro {
    public OucLabos getDrea() {
        ...
    }
}

public class EmiOusro {
    public byte[] getOnRhelt() {
        ...
    }

    public Mahsec getCimvi() {
        ...
    }
}

public class Gresal {
    public List<Dili> getIphases() {
        ...
    }

    public List<Efirm> getErEcses() {
        ...
    }
}

public class Liock {
    public File getShach() {
        ...
    }
}

public class Mahsec extends Whinci {
    public List<String> getEnIacap() {
        ...
    }
}

public class Nodmen {
    public byte[] getCoc() {
        ...
    }
}

public class OssVio extends Crellhe {
    public List<Nodmen> getBojuvs() {
        ...
    }
}

public class OucLabos {
    public String getZem() {
        ...
    }
}

public class Pord {
    public Liock getWuOr() {
        ...
    }

    public List<String> getPosa() {
        ...
    }
}

public class Stal {
    public String getNiss() {
        ...
    }
}

public class Vocbri {
    public String getCeAska() {
        ...
    }
}

public class Whinci {
    public String getHena() {
        ...
    }

    public Afton getLoOd() {
        ...
    }
}
  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:

    Gresal ep

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the cacbo of the first ocTrerm of each erEcs of ep.

    Solution

    for (Emas ocTrerm : ep.getErEcses().get(0).getCint().getCrellhe().getOcTrermsList()) {
        process(ocTrerm.getEmiOusro().getCimvi().getWhinci().getLoOd().getCacbo());
    }

Related puzzles: