Class relationships: Correct Solution


Consider the follow class declarations:

public class Chrerwe extends Thodbra {
    public NelBriad getNaes() {
        ...
    }
}

public class CicRil {
    public File getOss() {
        ...
    }
}

public class Cica {
    public int getRomia() {
        ...
    }

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

public class Codped extends CicRil {
    public List<PriPissdos> getPels() {
        ...
    }
}

public class Edsi {
    public File getIrKadin() {
        ...
    }
}

public class Grio {
    public Chrerwe getLaBrer() {
        ...
    }

    public List<Tosal> getSles() {
        ...
    }
}

public class NelBriad {
    public String getSik() {
        ...
    }
}

public class PriPissdos extends Qess {
    public List<Edsi> getGeSes() {
        ...
    }
}

public class Qess {
    public int getOtDassa() {
        ...
    }

    public Grio getPoOtri() {
        ...
    }
}

public class Thodbra extends ZorRadve {
    public List<Cica> getTuRulpas() {
        ...
    }
}

public class Tosal {
    public File getToclu() {
        ...
    }
}

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

    Codped it

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the givo of each tuRulpa of the first pel of it.

    Solution

    for (PriPissdos pel : it.getPelsList()) {
        process(pel.getQess().getPoOtri().getLaBrer().getThodbra().getTuRulpas().get(0).getGivo());
    }

Related puzzles: