Class relationships: Correct Solution


Consider the follow class declarations:

public class Afap {
    public int getCoHemop() {
        ...
    }

    public List<Plassme> getSirhis() {
        ...
    }
}

public class Caphe extends Trol {
    public String getAdpe() {
        ...
    }
}

public class CekSicsqi {
    public List<Guicwa> getDiIhaxs() {
        ...
    }

    public int getOdca() {
        ...
    }
}

public class Ceng {
    public Sceae getEnSoght() {
        ...
    }

    public List<Uwest> getCeds() {
        ...
    }
}

public class Coheon {
    public int getDrid() {
        ...
    }

    public List<DedSphureg> getAsms() {
        ...
    }
}

public class DedSphureg {
    public byte[] getDeUwho() {
        ...
    }
}

public class Diltes extends Scru {
    public int getCec() {
        ...
    }
}

public class Edosm {
    public List<Thico> getDiduas() {
        ...
    }

    public Glumoard getToCiesm() {
        ...
    }
}

public class Glumoard {
    public int getTorio() {
        ...
    }
}

public class Guicwa {
    public byte[] getPhaod() {
        ...
    }

    public Coheon getAnPlere() {
        ...
    }
}

public class Igpran extends Phitma {
    public List<CekSicsqi> getOors() {
        ...
    }
}

public class Milin extends Steqe {
    public List<Caphe> getEgas() {
        ...
    }
}

public class Minorch {
    public Milin getPniam() {
        ...
    }

    public int getAiol() {
        ...
    }
}

public class Mubi {
    public String getTru() {
        ...
    }

    public Minorch getCaCu() {
        ...
    }
}

public class NeuOlbic {
    public String getNoret() {
        ...
    }
}

public class Phitma extends Afap {
    public Ceng getTiasm() {
        ...
    }
}

public class Plassme {
    public byte[] getDilhi() {
        ...
    }
}

public class Santlas {
    public byte[] getAep() {
        ...
    }
}

public class Sceae {
    public List<String> getKeka() {
        ...
    }
}

public class Scru {
    public List<String> getClecs() {
        ...
    }

    public List<Mubi> getDous() {
        ...
    }
}

public class Steqe {
    public Santlas getVaAepre() {
        ...
    }

    public File getVeio() {
        ...
    }
}

public class Thico extends Igpran {
    public byte[] getOsild() {
        ...
    }
}

public class Trol extends NeuOlbic {
    public Edosm getPhint() {
        ...
    }
}

public class Uwest {
    public String getEspi() {
        ...
    }

    public byte[] getMesni() {
        ...
    }
}
  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:

    Diltes sles

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the mesni of the first ced of each didua of the first ega of the first dou of sles.

    Solution

    for (Mubi dou : sles.getScru().getDousList()) {
        for (Caphe ega : dou.getCaCu().getPniam().getEgasList()) {
            for (Uwest ced : ega.getTrol().getPhint().getDiduas().get(0).getIgpran().getPhitma().getTiasm().getCedsList()) {
                process(ced.getMesni());
            }
        }
    }

Related puzzles: