Class relationships: Correct Solution


Consider the follow class declarations:

public class Aentpra extends Oskwis {
    public byte[] getTeor() {
        ...
    }
}

public class CesDapung extends MioJod {
    public byte[] getPedid() {
        ...
    }
}

public class Gerd {
    public String getLeta() {
        ...
    }
}

public class Mespism {
    public String getPebpa() {
        ...
    }
}

public class MioJod {
    public byte[] getHemos() {
        ...
    }

    public List<Trosmlu> getAhSpis() {
        ...
    }
}

public class Noce {
    public List<String> getNiss() {
        ...
    }
}

public class Oskwis {
    public CesDapung getRir() {
        ...
    }

    public Paoc getEtChua() {
        ...
    }
}

public class Paoc {
    public List<String> getPulam() {
        ...
    }
}

public class Phoaec extends Noce {
    public Uscur getEmOsdi() {
        ...
    }

    public List<Mespism> getOuuses() {
        ...
    }
}

public class Primont {
    public Salset getEsGost() {
        ...
    }

    public String getSchem() {
        ...
    }

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

public class Salset {
    public byte[] getCik() {
        ...
    }
}

public class Trosmlu extends Primont {
    public Twedir getNoAgpel() {
        ...
    }
}

public class Twedir {
    public List<Gerd> getEoPnashs() {
        ...
    }

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

public class Uscur {
    public String getSokel() {
        ...
    }

    public List<Aentpra> getSceocs() {
        ...
    }
}
  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:

    Phoaec dris

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the ertin of each ahSpi of each sceoc of dris.

    Solution

    process(dris.getEmOsdi().getSceocs().get(0).getOskwis().getRir().getMioJod().getAhSpis().get(0).getPrimont().getErtin());

Related puzzles: