Class relationships: Correct Solution


Consider the follow class declarations:

public class AngCeir {
    public byte[] getTuago() {
        ...
    }
}

public class Ceido {
    public int getHePi() {
        ...
    }
}

public class Ceta {
    public List<Dospi> getDeors() {
        ...
    }

    public AngCeir getFoCa() {
        ...
    }
}

public class Dospi {
    public Pussne getOrRosil() {
        ...
    }

    public File getZou() {
        ...
    }
}

public class Earhet {
    public Reca getScu() {
        ...
    }

    public List<Pounqe> getBiprus() {
        ...
    }
}

public class Ecmod {
    public List<String> getFemio() {
        ...
    }
}

public class Esstrac {
    public List<Geian> getCuIanvis() {
        ...
    }

    public int getDoirn() {
        ...
    }
}

public class Geian {
    public Ceido getLodel() {
        ...
    }

    public String getNedan() {
        ...
    }
}

public class Liaw {
    public byte[] getSolgo() {
        ...
    }
}

public class Pasm extends Ecmod {
    public List<Phippli> getBeles() {
        ...
    }
}

public class Pecdend {
    public String getMue() {
        ...
    }

    public int getFiol() {
        ...
    }
}

public class Phippli {
    public Strel getCang() {
        ...
    }

    public List<Liaw> getAnphes() {
        ...
    }

    public Esstrac getAcku() {
        ...
    }
}

public class Pounqe {
    public byte[] getSqass() {
        ...
    }
}

public class Pussne extends Earhet {
    public byte[] getEgrio() {
        ...
    }
}

public class Reca extends Pasm {
    public String getSidir() {
        ...
    }
}

public class Strel {
    public File getVigla() {
        ...
    }

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

    Ceta skor

    ...and the following method:

    public void process(int item)

    ...write code to process the fiol of the first cla of each bele of each deor of skor.

    Solution

    for (Pecdend cla : skor.getDeors().get(0).getOrRosil().getEarhet().getScu().getPasm().getBeles().get(0).getCang().getClasList()) {
        process(cla.getFiol());
    }

Related puzzles: