Class relationships: Correct Solution


Consider the follow class declarations:

public class Drictwal extends Knalut {
    public List<Niliud> getUpIcs() {
        ...
    }
}

public class Enmis extends Roffpe {
    public int getAdCe() {
        ...
    }
}

public class Knalut {
    public byte[] getTaer() {
        ...
    }

    public Pongtriaw getPrupu() {
        ...
    }
}

public class Niliud extends Ressrha {
    public int getDrea() {
        ...
    }

    public int getPaiss() {
        ...
    }
}

public class Pongtriaw {
    public String getEeSobe() {
        ...
    }
}

public class Qase {
    public List<Enmis> getIdtrus() {
        ...
    }

    public String getStic() {
        ...
    }
}

public class Ressrha {
    public List<String> getCoAx() {
        ...
    }
}

public class Roffpe {
    public Drictwal getPsuss() {
        ...
    }

    public String getStis() {
        ...
    }
}
  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:

    Qase nex

    ...and the following method:

    public void process(int item)

    ...write code to process the paiss of each upIc of the first idtru of nex.

    Solution

    for (Enmis idtru : nex.getIdtrusList()) {
        process(idtru.getRoffpe().getPsuss().getUpIcs().get(0).getPaiss());
    }

Related puzzles: