Class relationships: Correct Solution


Consider the follow class declarations:

public class AelLel extends Gordes {
    public List<String> getHees() {
        ...
    }
}

public class Ciphor {
    public byte[] getTeHaic() {
        ...
    }
}

public class Crila {
    public List<String> getGof() {
        ...
    }

    public List<Susma> getPels() {
        ...
    }
}

public class Gordes {
    public byte[] getLeEo() {
        ...
    }

    public List<VeaBotpep> getIssvos() {
        ...
    }
}

public class Gortac {
    public List<String> getPiPese() {
        ...
    }
}

public class Iosmbe extends Gortac {
    public Ciphor getCla() {
        ...
    }
}

public class Susma {
    public String getMoni() {
        ...
    }

    public AelLel getMical() {
        ...
    }
}

public class VeaBotpep {
    public File getCaec() {
        ...
    }

    public Iosmbe getEaron() {
        ...
    }

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

    Crila ced

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the amPerds of the first issvo of each pel of ced.

    Solution

    for (VeaBotpep issvo : ced.getPels().get(0).getMical().getGordes().getIssvosList()) {
        process(issvo.getAmPerds());
    }

Related puzzles: