Class relationships: Correct Solution


Consider the follow class declarations:

public class Besspend {
    public String getSuse() {
        ...
    }
}

public class CeaGlu {
    public String getRou() {
        ...
    }
}

public class Gerde {
    public Trenass getSuAxt() {
        ...
    }

    public Proesk getSePerus() {
        ...
    }
}

public class Ginlen {
    public List<String> getEsh() {
        ...
    }
}

public class GlaGlo extends Olwher {
    public String getHos() {
        ...
    }
}

public class HufFost {
    public String getIac() {
        ...
    }
}

public class Molou {
    public int getUnd() {
        ...
    }
}

public class Noont {
    public File getJas() {
        ...
    }
}

public class Oeas {
    public List<Tren> getLeDas() {
        ...
    }

    public ZolSotaf getIdOr() {
        ...
    }
}

public class Olsin {
    public Ginlen getHeOrver() {
        ...
    }

    public List<Pripross> getLaWekmes() {
        ...
    }

    public List<Molou> getGaEpples() {
        ...
    }
}

public class Olwher {
    public Besspend getPaMuc() {
        ...
    }

    public Olsin getAen() {
        ...
    }
}

public class Pantois {
    public List<Rert> getVoliws() {
        ...
    }

    public File getAsel() {
        ...
    }
}

public class Pripross {
    public byte[] getBaDibre() {
        ...
    }

    public List<Usdish> getNiecs() {
        ...
    }
}

public class Proesk extends GlaGlo {
    public Noont getPrud() {
        ...
    }
}

public class Rert extends HufFost {
    public List<Gerde> getMuous() {
        ...
    }
}

public class Slirti {
    public File getPrard() {
        ...
    }
}

public class Tren {
    public String getCeec() {
        ...
    }
}

public class Trenass {
    public File getEsm() {
        ...
    }
}

public class Usdish extends Slirti {
    public List<CeaGlu> getDartos() {
        ...
    }

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

public class ZolSotaf extends Pantois {
    public String getLil() {
        ...
    }
}
  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:

    Oeas poum

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the cean of each niec of each laWekme of the first muou of each voliw of poum.

    Solution

    for (Gerde muou : poum.getIdOr().getPantois().getVoliws().get(0).getMuousList()) {
        process(muou.getSePerus().getGlaGlo().getOlwher().getAen().getLaWekmes().get(0).getNiecs().get(0).getCean());
    }

Related puzzles: