Class relationships: Correct Solution


Consider the follow class declarations:

public class Cenec {
    public List<String> getEmi() {
        ...
    }
}

public class Doofloc {
    public int getMeEn() {
        ...
    }

    public List<Kapfe> getPolols() {
        ...
    }
}

public class Fange {
    public File getEsen() {
        ...
    }

    public List<Presen> getNiPromps() {
        ...
    }
}

public class Goue extends Doofloc {
    public List<Tenup> getOlPepics() {
        ...
    }
}

public class Iones {
    public File getBita() {
        ...
    }
}

public class Kapfe {
    public File getDoas() {
        ...
    }
}

public class Naltrac extends Fange {
    public Cenec getLadar() {
        ...
    }

    public Iones getMuha() {
        ...
    }
}

public class Presen extends Tildcip {
    public List<String> getEpod() {
        ...
    }
}

public class Tenup {
    public List<String> getOncol() {
        ...
    }

    public Naltrac getReum() {
        ...
    }
}

public class Tildcip {
    public byte[] getEtFo() {
        ...
    }

    public File getIeste() {
        ...
    }
}
  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:

    Goue ea

    ...and the following method:

    public void process(File item)

    ...write code to process the ieste of the first niPromp of the first olPepic of ea.

    Solution

    for (Tenup olPepic : ea.getOlPepicsList()) {
        for (Presen niPromp : olPepic.getReum().getFange().getNiPrompsList()) {
            process(niPromp.getTildcip().getIeste());
        }
    }

Related puzzles: