Class relationships: Correct Solution


Consider the follow class declarations:

public class Angcer {
    public byte[] getDaCheti() {
        ...
    }
}

public class Ciro extends Greshsiok {
    public Dramet getSiera() {
        ...
    }
}

public class Dramet extends IldPheane {
    public String getIrooc() {
        ...
    }
}

public class Eanbrin extends Pripre {
    public String getDuCras() {
        ...
    }
}

public class Greshsiok {
    public List<Hadea> getMiTonmos() {
        ...
    }

    public int getPsen() {
        ...
    }
}

public class Hadea {
    public int getPolzi() {
        ...
    }
}

public class Hidoon {
    public String getOlOis() {
        ...
    }
}

public class IldPheane extends Hidoon {
    public Plesshue getHuor() {
        ...
    }
}

public class Irtric {
    public List<String> getHaner() {
        ...
    }
}

public class Osacs {
    public SorAlchress getHiTes() {
        ...
    }

    public File getEde() {
        ...
    }
}

public class Pidthes {
    public byte[] getEazol() {
        ...
    }

    public List<Osacs> getMuecs() {
        ...
    }
}

public class PleDolmia extends Prar {
    public String getTira() {
        ...
    }
}

public class Plesshue extends Pidthes {
    public String getIouss() {
        ...
    }
}

public class Prar {
    public String getVulid() {
        ...
    }
}

public class Pripre {
    public File getUntad() {
        ...
    }
}

public class SorAlchress {
    public String getFusm() {
        ...
    }

    public String getAau() {
        ...
    }
}

public class TroStedia {
    public Irtric getPece() {
        ...
    }

    public List<PleDolmia> getPels() {
        ...
    }

    public List<Ciro> getDadhos() {
        ...
    }
}

public class Ures {
    public List<Eanbrin> getThrils() {
        ...
    }

    public Angcer getBaEnil() {
        ...
    }

    public List<Zastra> getPhics() {
        ...
    }
}

public class Usree extends Ures {
    public byte[] getRaVed() {
        ...
    }
}

public class Zastra {
    public TroStedia getPiost() {
        ...
    }

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

    Usree ce

    ...and the following method:

    public void process(String item)

    ...write code to process the aau of the first muec of each dadho of each phic of ce.

    Solution

    for (Osacs muec : ce.getUres().getPhics().get(0).getPiost().getDadhos().get(0).getSiera().getIldPheane().getHuor().getPidthes().getMuecsList()) {
        process(muec.getHiTes().getAau());
    }

Related puzzles: