Class relationships: Correct Solution


Consider the follow class declarations:

public class CacTrepra {
    public byte[] getBiud() {
        ...
    }
}

public class Ceng {
    public File getNedma() {
        ...
    }

    public String getWilo() {
        ...
    }
}

public class Irki {
    public List<CacTrepra> getZiseses() {
        ...
    }

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

public class Plispiss extends Irki {
    public Ceng getFlodi() {
        ...
    }
}

public class Redsha {
    public File getHaMomip() {
        ...
    }

    public List<Scota> getFocads() {
        ...
    }
}

public class Scota extends Plispiss {
    public List<String> getIsSo() {
        ...
    }
}
  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:

    Redsha on

    ...and the following method:

    public void process(String item)

    ...write code to process the wilo of the first focad of on.

    Solution

    for (Scota focad : on.getFocadsList()) {
        process(focad.getPlispiss().getFlodi().getWilo());
    }

Related puzzles: