Class relationships: Correct Solution


Consider the follow class declarations:

public class Chosel {
    public String getWimda() {
        ...
    }
}

public class Crire {
    public List<String> getCeaki() {
        ...
    }
}

public class Emung {
    public List<String> getEsm() {
        ...
    }

    public Ralal getOul() {
        ...
    }
}

public class Fring {
    public byte[] getOgrec() {
        ...
    }
}

public class Leong {
    public int getJesmi() {
        ...
    }
}

public class Lousscom {
    public Risal getLaff() {
        ...
    }

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

public class MakPeewlnos extends Shoint {
    public List<Leong> getOntpos() {
        ...
    }

    public Rerk getPerd() {
        ...
    }

    public List<OocCeff> getPras() {
        ...
    }

    public Fring getScoen() {
        ...
    }
}

public class Ninglon {
    public byte[] getChre() {
        ...
    }
}

public class OocCeff extends Ushpsen {
    public List<String> getCel() {
        ...
    }
}

public class Pefess extends Risspne {
    public int getLont() {
        ...
    }
}

public class Pestou {
    public List<String> getSuOiar() {
        ...
    }

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

public class Psoss {
    public int getDeang() {
        ...
    }
}

public class Ralal {
    public List<Ninglon> getTiems() {
        ...
    }

    public List<Lousscom> getCins() {
        ...
    }

    public Psoss getElPle() {
        ...
    }
}

public class Reashin {
    public byte[] getGesm() {
        ...
    }
}

public class Rerk {
    public int getMeDoess() {
        ...
    }
}

public class Risal extends Spirent {
    public File getTetuc() {
        ...
    }
}

public class Risspne {
    public List<String> getDiOrgu() {
        ...
    }

    public List<Pestou> getEdIengs() {
        ...
    }
}

public class Shoint extends Emung {
    public File getRanbi() {
        ...
    }
}

public class Spirent {
    public Reashin getClora() {
        ...
    }

    public List<Pefess> getSeshs() {
        ...
    }
}

public class Tuncuc {
    public Unop getOrEtsa() {
        ...
    }

    public int getAclis() {
        ...
    }
}

public class Unop extends Chosel {
    public List<Crire> getCuIges() {
        ...
    }

    public List<MakPeewlnos> getPamdes() {
        ...
    }
}

public class Ushpsen {
    public File getInIc() {
        ...
    }
}
  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:

    Tuncuc se

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the uaDe of the first edIeng of the first sesh of the first cin of each pamde of se.

    Solution

    for (Lousscom cin : se.getOrEtsa().getPamdes().get(0).getShoint().getEmung().getOul().getCinsList()) {
        for (Pefess sesh : cin.getLaff().getSpirent().getSeshsList()) {
            for (Pestou edIeng : sesh.getRisspne().getEdIengsList()) {
                process(edIeng.getUaDe());
            }
        }
    }

Related puzzles: