Class relationships: Correct Solution


Consider the follow class declarations:

public class Aloc extends Unon {
    public String getRaus() {
        ...
    }
}

public class AtoVoor extends Aloc {
    public int getOsDre() {
        ...
    }
}

public class Cluwaun {
    public int getWiTrol() {
        ...
    }

    public List<Liprer> getLels() {
        ...
    }
}

public class Dord {
    public List<String> getOnch() {
        ...
    }
}

public class Drontnai {
    public String getEdmes() {
        ...
    }

    public List<AtoVoor> getEnBas() {
        ...
    }
}

public class Droueer extends Stiam {
    public List<Masmfoer> getErms() {
        ...
    }
}

public class Eseng {
    public List<Spodsi> getPiLis() {
        ...
    }

    public List<Droueer> getOcGics() {
        ...
    }
}

public class EutProssar {
    public String getRirks() {
        ...
    }
}

public class Evish {
    public List<String> getOel() {
        ...
    }
}

public class Gawri {
    public List<Dord> getLinals() {
        ...
    }

    public Trafat getWhul() {
        ...
    }
}

public class Grithioups {
    public File getEsec() {
        ...
    }
}

public class Isiaf {
    public List<String> getSted() {
        ...
    }
}

public class Kurgu {
    public Drontnai getMur() {
        ...
    }

    public int getHifin() {
        ...
    }
}

public class Liprer {
    public byte[] getBasi() {
        ...
    }
}

public class Masmfoer extends Ponma {
    public byte[] getGac() {
        ...
    }
}

public class Miodd {
    public String getJirsa() {
        ...
    }

    public int getTreur() {
        ...
    }
}

public class Ponma {
    public Gawri getGiOa() {
        ...
    }

    public Cluwaun getSoMiga() {
        ...
    }
}

public class Sphu {
    public int getOnMolon() {
        ...
    }

    public List<Grithioups> getIdNecres() {
        ...
    }
}

public class Spodsi {
    public List<String> getEdwod() {
        ...
    }
}

public class Stiam {
    public int getCheme() {
        ...
    }
}

public class Trafat extends Miodd {
    public String getPaPo() {
        ...
    }
}

public class Unon extends EutProssar {
    public Eseng getNen() {
        ...
    }

    public Evish getErul() {
        ...
    }

    public List<Sphu> getJods() {
        ...
    }

    public Isiaf getIrd() {
        ...
    }
}
  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:

    Kurgu fi

    ...and the following method:

    public void process(int item)

    ...write code to process the treur of the first erm of the first ocGic of each enBa of fi.

    Solution

    for (Droueer ocGic : fi.getMur().getEnBas().get(0).getAloc().getUnon().getNen().getOcGicsList()) {
        for (Masmfoer erm : ocGic.getErmsList()) {
            process(erm.getPonma().getGiOa().getWhul().getMiodd().getTreur());
        }
    }

Related puzzles: