Class relationships: Correct Solution


Consider the follow class declarations:

public class Basse extends TesReng {
    public Olpec getAlHo() {
        ...
    }
}

public class Filir {
    public byte[] getPai() {
        ...
    }
}

public class LicMaism {
    public String getPempa() {
        ...
    }
}

public class Morphor {
    public List<Filir> getAnIos() {
        ...
    }

    public List<LicMaism> getRaSmads() {
        ...
    }

    public List<Wess> getSpiens() {
        ...
    }
}

public class Nolluss extends Basse {
    public byte[] getAess() {
        ...
    }
}

public class Olpec {
    public List<String> getPhia() {
        ...
    }
}

public class TesReng {
    public List<String> getOxi() {
        ...
    }

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

public class Wess {
    public Nolluss getCed() {
        ...
    }

    public int getNilbe() {
        ...
    }
}
  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:

    Morphor li

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the inHepel of the first spien of li.

    Solution

    for (Wess spien : li.getSpiensList()) {
        process(spien.getCed().getBasse().getTesReng().getInHepel());
    }

Related puzzles: