Class relationships: Correct Solution


Consider the follow class declarations:

public class Bedjod extends Lepic {
    public int getGani() {
        ...
    }
}

public class Cemost extends Cheuck {
    public String getEsOun() {
        ...
    }
}

public class Cheuck {
    public String getEstco() {
        ...
    }

    public List<Utek> getSchas() {
        ...
    }
}

public class Chinthoc {
    public List<Mossrou> getBaents() {
        ...
    }

    public List<String> getEcpe() {
        ...
    }
}

public class FleIrmvass {
    public List<String> getIsong() {
        ...
    }

    public List<Bedjod> getNuds() {
        ...
    }
}

public class Lepic extends Tabam {
    public Chinthoc getLaZeo() {
        ...
    }

    public Puwngha getGrauc() {
        ...
    }

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

public class Mossrou {
    public byte[] getNuss() {
        ...
    }
}

public class Puwngha {
    public byte[] getPihu() {
        ...
    }
}

public class Tabam {
    public List<String> getDrouc() {
        ...
    }
}

public class Utek {
    public File getRiCahed() {
        ...
    }

    public FleIrmvass getNer() {
        ...
    }
}
  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:

    Cemost oste

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the blacs of the first nud of the first scha of oste.

    Solution

    for (Utek scha : oste.getCheuck().getSchasList()) {
        for (Bedjod nud : scha.getNer().getNudsList()) {
            process(nud.getLepic().getBlacs());
        }
    }

Related puzzles: