Class relationships: Correct Solution


Consider the follow class declarations:

public class Chlol extends Enerd {
    public List<String> getPriou() {
        ...
    }
}

public class Ecpil {
    public List<Saarth> getApSadons() {
        ...
    }

    public List<Chlol> getCaAnmods() {
        ...
    }

    public Issol getHaba() {
        ...
    }
}

public class Enerd {
    public Slion getPacon() {
        ...
    }

    public File getEsSimel() {
        ...
    }
}

public class Issbrer {
    public List<String> getShapa() {
        ...
    }

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

public class Issol {
    public File getCiPri() {
        ...
    }
}

public class Saarth {
    public int getModed() {
        ...
    }
}

public class Slion extends Issbrer {
    public Whede getDoce() {
        ...
    }
}

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

    Ecpil mif

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the otred of the first caAnmod of mif.

    Solution

    for (Chlol caAnmod : mif.getCaAnmodsList()) {
        process(caAnmod.getEnerd().getPacon().getIssbrer().getOtred());
    }

Related puzzles: