Class relationships: Correct Solution


Consider the follow class declarations:

public class Chewnpriod extends Ecdri {
    public List<String> getFlest() {
        ...
    }
}

public class Delphle {
    public Gloordu getLani() {
        ...
    }

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

public class Ecdri {
    public List<Paeshon> getEcPes() {
        ...
    }

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

public class Gloordu {
    public List<Chewnpriod> getAsspes() {
        ...
    }

    public Tenclec getMic() {
        ...
    }
}

public class Paeshon {
    public List<Roccu> getSuFos() {
        ...
    }

    public String getPabes() {
        ...
    }

    public File getWeden() {
        ...
    }
}

public class Roccu {
    public byte[] getCrio() {
        ...
    }
}

public class Tenclec extends Touc {
    public File getAntne() {
        ...
    }
}

public class Touc {
    public int getLafo() {
        ...
    }
}
  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:

    Delphle puis

    ...and the following method:

    public void process(File item)

    ...write code to process the weden of the first ecPe of the first asspe of puis.

    Solution

    for (Chewnpriod asspe : puis.getLani().getAsspesList()) {
        for (Paeshon ecPe : asspe.getEcdri().getEcPesList()) {
            process(ecPe.getWeden());
        }
    }

Related puzzles: