Class relationships: Correct Solution


Consider the follow class declarations:

public class Astheg {
    public List<Fuung> getEfalls() {
        ...
    }

    public Cedor getPemsa() {
        ...
    }
}

public class Cedor extends Twoen {
    public File getFeen() {
        ...
    }
}

public class Ciapek extends Roushvoant {
    public Mipe getHuo() {
        ...
    }
}

public class Daix {
    public Ecwuck getScics() {
        ...
    }

    public List<Dienwi> getMaSus() {
        ...
    }

    public List<Nisplo> getSases() {
        ...
    }
}

public class Dienwi {
    public Imwhas getDusm() {
        ...
    }

    public Peingvi getHipra() {
        ...
    }
}

public class Ecwuck {
    public File getPric() {
        ...
    }
}

public class Etchbeng {
    public File getSiPlell() {
        ...
    }
}

public class Frid extends Oljast {
    public Gind getCorsi() {
        ...
    }
}

public class Fuung {
    public byte[] getTriso() {
        ...
    }
}

public class Gheegh {
    public byte[] getKuFo() {
        ...
    }
}

public class Gind extends Daix {
    public File getChoad() {
        ...
    }
}

public class Imwhas {
    public List<Soos> getCengs() {
        ...
    }

    public Gheegh getAnEr() {
        ...
    }
}

public class Mipe extends Frid {
    public List<String> getCeRis() {
        ...
    }
}

public class Moprios {
    public Tros getBeHess() {
        ...
    }

    public List<Ciapek> getToIors() {
        ...
    }
}

public class Nisplo {
    public List<String> getCiKopre() {
        ...
    }
}

public class Oljast {
    public int getHoTaed() {
        ...
    }
}

public class Peingvi extends PiwCiasmhem {
    public String getOsca() {
        ...
    }
}

public class Peukplos {
    public byte[] getStec() {
        ...
    }
}

public class Pirnfioc {
    public File getCang() {
        ...
    }

    public String getThi() {
        ...
    }
}

public class PiwCiasmhem {
    public String getEaGna() {
        ...
    }
}

public class Roushvoant {
    public File getSprun() {
        ...
    }
}

public class Soos extends Pirnfioc {
    public String getIseo() {
        ...
    }
}

public class Tros {
    public List<String> getMecer() {
        ...
    }

    public List<Etchbeng> getEnPhes() {
        ...
    }
}

public class Twoen extends Peukplos {
    public List<Moprios> getTrioms() {
        ...
    }
}
  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:

    Astheg id

    ...and the following method:

    public void process(String item)

    ...write code to process the thi of the first ceng of each maSu of each toIor of the first triom of id.

    Solution

    for (Moprios triom : id.getPemsa().getTwoen().getTriomsList()) {
        for (Soos ceng : triom.getToIors().get(0).getHuo().getFrid().getCorsi().getDaix().getMaSus().get(0).getDusm().getCengsList()) {
            process(ceng.getPirnfioc().getThi());
        }
    }

Related puzzles: