Class relationships: Correct Solution


Consider the follow class declarations:

public class Bostoac {
    public byte[] getEces() {
        ...
    }
}

public class Flerull {
    public String getHaIx() {
        ...
    }

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

public class Mitrum extends Thuil {
    public File getSarm() {
        ...
    }
}

public class Piondu {
    public Flerull getEdIs() {
        ...
    }

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

public class RirPesmwaen {
    public byte[] getFuVeea() {
        ...
    }
}

public class Screr {
    public Bostoac getLuDoir() {
        ...
    }

    public String getAmod() {
        ...
    }
}

public class Thuil {
    public Tradgit getFrent() {
        ...
    }

    public String getRoude() {
        ...
    }
}

public class Tradgit extends Screr {
    public List<RirPesmwaen> getBlis() {
        ...
    }

    public List<Piondu> getDiLamads() {
        ...
    }
}
  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:

    Mitrum in

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the saPlofe of the first diLamad of in.

    Solution

    for (Piondu diLamad : in.getThuil().getFrent().getDiLamadsList()) {
        process(diLamad.getEdIs().getSaPlofe());
    }

Related puzzles: