Class relationships: Correct Solution


Consider the follow class declarations:

public class Engrun {
    public byte[] getPiIac() {
        ...
    }
}

public class Ewcu {
    public List<String> getShose() {
        ...
    }

    public Minmul getIdash() {
        ...
    }
}

public class Gupe {
    public String getBou() {
        ...
    }
}

public class IodSaengro {
    public Podon getOsCoira() {
        ...
    }

    public File getPeSo() {
        ...
    }
}

public class Liam {
    public int getPna() {
        ...
    }

    public List<Splen> getMoWhases() {
        ...
    }
}

public class Minmul {
    public List<String> getUph() {
        ...
    }
}

public class Peasil {
    public byte[] getOnd() {
        ...
    }

    public File getSliso() {
        ...
    }
}

public class PelFeterd {
    public List<Gupe> getIcEfoins() {
        ...
    }

    public List<IodSaengro> getEoNeses() {
        ...
    }
}

public class Podon extends Ewcu {
    public List<Peasil> getUhacs() {
        ...
    }
}

public class PriUlve extends Usmas {
    public String getNuc() {
        ...
    }
}

public class ScoRiatras {
    public List<PriUlve> getEtants() {
        ...
    }

    public Liam getUnt() {
        ...
    }
}

public class Spicoi extends Engrun {
    public ScoRiatras getOnFoqo() {
        ...
    }
}

public class Splen {
    public List<String> getHeStui() {
        ...
    }
}

public class Usmas extends PelFeterd {
    public List<String> getRiBrec() {
        ...
    }
}
  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:

    Spicoi ciss

    ...and the following method:

    public void process(File item)

    ...write code to process the sliso of each uhac of the first eoNes of each etant of ciss.

    Solution

    for (IodSaengro eoNes : ciss.getOnFoqo().getEtants().get(0).getUsmas().getPelFeterd().getEoNesesList()) {
        process(eoNes.getOsCoira().getUhacs().get(0).getSliso());
    }

Related puzzles: