Class relationships: Correct Solution


Consider the follow class declarations:

public class Bluno {
    public Hioc getItou() {
        ...
    }

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

public class Chrol {
    public int getEsSiaci() {
        ...
    }

    public File getScha() {
        ...
    }
}

public class Ciasses extends Nilpel {
    public Ostrel getEoCa() {
        ...
    }
}

public class Clees {
    public Troulphos getPerci() {
        ...
    }

    public List<Chrol> getHecas() {
        ...
    }
}

public class Glunoc {
    public List<Milun> getHaEnics() {
        ...
    }

    public int getEno() {
        ...
    }
}

public class Hioc {
    public String getPra() {
        ...
    }

    public List<Scinggle> getEmos() {
        ...
    }
}

public class Knangpass extends Clees {
    public List<Sesmuc> getNiocs() {
        ...
    }
}

public class Megnur extends Plii {
    public Ciasses getMeArned() {
        ...
    }
}

public class Milun {
    public String getTio() {
        ...
    }
}

public class Nilpel {
    public byte[] getTeDapal() {
        ...
    }
}

public class Ostrel {
    public int getTiLe() {
        ...
    }
}

public class Plii {
    public byte[] getSairo() {
        ...
    }

    public List<Ptel> getQaAns() {
        ...
    }
}

public class Ptel extends Bluno {
    public List<String> getIrPhoud() {
        ...
    }
}

public class Riafrus {
    public Megnur getGeni() {
        ...
    }

    public RirScurieng getSaleo() {
        ...
    }
}

public class RirScurieng {
    public List<String> getSest() {
        ...
    }

    public List<Glunoc> getOsPnehes() {
        ...
    }
}

public class Scinggle {
    public Knangpass getPral() {
        ...
    }

    public int getIxo() {
        ...
    }
}

public class Sesmuc {
    public List<String> getCacew() {
        ...
    }
}

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

    Riafrus ze

    ...and the following method:

    public void process(File item)

    ...write code to process the scha of the first heca of the first emo of each qaAn of ze.

    Solution

    for (Scinggle emo : ze.getGeni().getPlii().getQaAns().get(0).getBluno().getItou().getEmosList()) {
        for (Chrol heca : emo.getPral().getClees().getHecasList()) {
            process(heca.getScha());
        }
    }

Related puzzles: