Class relationships: Correct Solution


Consider the follow class declarations:

public class CilMinnin extends Flas {
    public Dentla getWrin() {
        ...
    }

    public Talfla getSeSeu() {
        ...
    }
}

public class Dentla {
    public List<String> getOdse() {
        ...
    }
}

public class Flas {
    public Tiaf getBui() {
        ...
    }

    public File getEsPo() {
        ...
    }
}

public class Gass extends VouKnivek {
    public List<String> getPaCe() {
        ...
    }
}

public class Gemil {
    public List<Phermshos> getNeEncus() {
        ...
    }

    public String getGrerb() {
        ...
    }
}

public class Phermshos extends Ruend {
    public List<String> getOuss() {
        ...
    }
}

public class PsoTherblio {
    public Viden getOsmec() {
        ...
    }

    public int getNio() {
        ...
    }
}

public class Ruend {
    public List<Gass> getGitos() {
        ...
    }

    public CilMinnin getNiosm() {
        ...
    }
}

public class Sosm {
    public File getWhi() {
        ...
    }
}

public class Talfla {
    public File getOmHatar() {
        ...
    }
}

public class Telgo {
    public List<Sosm> getTaSencts() {
        ...
    }

    public int getDegos() {
        ...
    }
}

public class Tiaf extends Telgo {
    public List<PsoTherblio> getHiCrecs() {
        ...
    }
}

public class Viden {
    public File getCuSaes() {
        ...
    }

    public byte[] getDioun() {
        ...
    }
}

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

    Gemil shos

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the dioun of the first hiCrec of each neEncu of shos.

    Solution

    for (PsoTherblio hiCrec : shos.getNeEncus().get(0).getRuend().getNiosm().getFlas().getBui().getHiCrecsList()) {
        process(hiCrec.getOsmec().getDioun());
    }

Related puzzles: