Class relationships: Correct Solution


Consider the follow class declarations:

public class Ceadbent {
    public String getHeosm() {
        ...
    }
}

public class Cisasm {
    public int getHiara() {
        ...
    }
}

public class Garva extends Susmert {
    public List<String> getUedi() {
        ...
    }
}

public class Glintpen {
    public byte[] getEcbic() {
        ...
    }

    public List<Shoceam> getEdas() {
        ...
    }
}

public class Iomem {
    public List<Themist> getSases() {
        ...
    }

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

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

public class Irde {
    public Penperm getOchoo() {
        ...
    }

    public int getSaeo() {
        ...
    }
}

public class Nonthe extends Iomem {
    public Ceadbent getThric() {
        ...
    }

    public List<Tucbo> getAuhis() {
        ...
    }
}

public class Penperm {
    public List<Nonthe> getReEds() {
        ...
    }

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

public class Pohar {
    public byte[] getDeth() {
        ...
    }
}

public class Priad extends Glintpen {
    public Pohar getDiOng() {
        ...
    }
}

public class Psetpid extends QulMeock {
    public File getSchal() {
        ...
    }
}

public class QulMeock {
    public List<Irde> getCils() {
        ...
    }

    public Cisasm getKocga() {
        ...
    }
}

public class Shoceam {
    public Psetpid getCin() {
        ...
    }

    public Garva getAthi() {
        ...
    }
}

public class Susmert {
    public byte[] getSuIss() {
        ...
    }
}

public class Themist {
    public File getCau() {
        ...
    }
}

public class Tucbo {
    public String getBaHe() {
        ...
    }
}
  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:

    Priad sicu

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the ourd of the first reEd of each cil of the first eda of sicu.

    Solution

    for (Shoceam eda : sicu.getGlintpen().getEdasList()) {
        for (Nonthe reEd : eda.getCin().getQulMeock().getCils().get(0).getOchoo().getReEdsList()) {
            process(reEd.getIomem().getOurd());
        }
    }

Related puzzles: