Class relationships: Correct Solution


Consider the follow class declarations:

public class Beonroo {
    public byte[] getNia() {
        ...
    }
}

public class CoiReorved {
    public Jisma getScri() {
        ...
    }

    public List<Hosmstrair> getBeOprens() {
        ...
    }
}

public class Dism {
    public List<Omstep> getPiras() {
        ...
    }

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

public class Fasta {
    public Sedtren getCarnu() {
        ...
    }

    public String getVuzor() {
        ...
    }
}

public class Flar {
    public List<String> getDuss() {
        ...
    }
}

public class Glon {
    public List<String> getAnCras() {
        ...
    }
}

public class Heass {
    public List<Ubriss> getIrAngs() {
        ...
    }

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

public class Hosmstrair {
    public MicPeous getSeOrasm() {
        ...
    }

    public int getJapo() {
        ...
    }
}

public class Isspel extends Dism {
    public Kaen getPec() {
        ...
    }
}

public class Jisma {
    public int getCaCroen() {
        ...
    }
}

public class Julan extends RolRefa {
    public List<String> getFrar() {
        ...
    }
}

public class Kaen extends Beonroo {
    public byte[] getGri() {
        ...
    }
}

public class LaaCism {
    public String getClol() {
        ...
    }
}

public class MicPeous extends Fasta {
    public List<Prertha> getOsErsas() {
        ...
    }
}

public class Omstep {
    public Pemur getPhee() {
        ...
    }

    public Heass getPsar() {
        ...
    }
}

public class Pemur {
    public int getFoc() {
        ...
    }

    public String getXeMo() {
        ...
    }
}

public class Poher {
    public Julan getMip() {
        ...
    }

    public int getOaShuc() {
        ...
    }
}

public class Prertha {
    public byte[] getSead() {
        ...
    }

    public List<LaaCism> getSpeucs() {
        ...
    }
}

public class RolRefa extends Flar {
    public List<CoiReorved> getIeses() {
        ...
    }
}

public class Scaes {
    public int getBelpe() {
        ...
    }
}

public class Sedtren extends Touk {
    public List<String> getHonso() {
        ...
    }
}

public class Touk {
    public List<Isspel> getEebets() {
        ...
    }

    public List<Vida> getCiners() {
        ...
    }
}

public class Ubriss {
    public List<Glon> getFios() {
        ...
    }

    public Scaes getEnBunau() {
        ...
    }
}

public class Vida {
    public byte[] getAiPhrec() {
        ...
    }
}
  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:

    Poher rou

    ...and the following method:

    public void process(String item)

    ...write code to process the xeMo of the first pira of each eebet of each beOpren of the first ies of rou.

    Solution

    for (CoiReorved ies : rou.getMip().getRolRefa().getIesesList()) {
        for (Omstep pira : ies.getBeOprens().get(0).getSeOrasm().getFasta().getCarnu().getTouk().getEebets().get(0).getDism().getPirasList()) {
            process(pira.getPhee().getXeMo());
        }
    }

Related puzzles: