Class relationships: Correct Solution


Consider the follow class declarations:

public class Deasmun {
    public String getXin() {
        ...
    }

    public Phed getGeVae() {
        ...
    }
}

public class Neccost extends Senu {
    public Powl getEcba() {
        ...
    }

    public List<Stiel> getCesases() {
        ...
    }
}

public class Phed {
    public List<Sced> getBlis() {
        ...
    }

    public List<SomPrea> getShrors() {
        ...
    }
}

public class Powl {
    public int getTioc() {
        ...
    }
}

public class Sced {
    public List<String> getEcga() {
        ...
    }
}

public class Senu {
    public List<String> getSles() {
        ...
    }
}

public class Seothog extends Neccost {
    public int getTiCrol() {
        ...
    }
}

public class SomPrea {
    public File getSiAird() {
        ...
    }

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

public class Stiel extends Stothoom {
    public Deasmun getProl() {
        ...
    }
}

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

    Seothog stic

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the meis of each shror of the first cesas of stic.

    Solution

    for (Stiel cesas : stic.getNeccost().getCesasesList()) {
        process(cesas.getProl().getGeVae().getShrors().get(0).getMeis());
    }

Related puzzles: