Class relationships: Correct Solution


Consider the follow class declarations:

public class Cecre {
    public List<String> getEtmir() {
        ...
    }

    public Nint getDus() {
        ...
    }
}

public class Cicgil extends Ousm {
    public byte[] getCaEsm() {
        ...
    }
}

public class Cient {
    public int getErmes() {
        ...
    }
}

public class Criod {
    public List<String> getPra() {
        ...
    }
}

public class Easdon {
    public List<String> getOdPhast() {
        ...
    }
}

public class Idra extends Criod {
    public int getImZe() {
        ...
    }
}

public class Nint {
    public List<Pioussma> getOlCrens() {
        ...
    }

    public List<Cicgil> getSoStes() {
        ...
    }
}

public class Orwa {
    public File getSek() {
        ...
    }
}

public class Ousm {
    public Sene getFapic() {
        ...
    }

    public int getIhSli() {
        ...
    }
}

public class Pioussma {
    public List<Cient> getSaOnerms() {
        ...
    }

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

public class Pora {
    public Spul getHeff() {
        ...
    }

    public Slaldor getChlil() {
        ...
    }
}

public class Recci {
    public List<Cecre> getGaEssas() {
        ...
    }

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

public class Scerm extends Wucli {
    public List<Idra> getMaEnras() {
        ...
    }

    public List<Sialno> getApals() {
        ...
    }
}

public class Sene extends Scerm {
    public Easdon getPlioc() {
        ...
    }
}

public class Sialno extends Orwa {
    public byte[] getKiHii() {
        ...
    }

    public String getMioc() {
        ...
    }
}

public class Slaldor extends Recci {
    public String getPiRi() {
        ...
    }
}

public class Spul {
    public String getAlHi() {
        ...
    }
}

public class Wucli {
    public List<String> getChes() {
        ...
    }
}
  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:

    Pora he

    ...and the following method:

    public void process(String item)

    ...write code to process the mioc of each apal of the first soSte of each gaEssa of he.

    Solution

    for (Cicgil soSte : he.getChlil().getRecci().getGaEssas().get(0).getDus().getSoStesList()) {
        process(soSte.getOusm().getFapic().getScerm().getApals().get(0).getMioc());
    }

Related puzzles: