Class relationships: Correct Solution


Consider the follow class declarations:

public class Brap {
    public List<String> getDiAiss() {
        ...
    }

    public String getCeng() {
        ...
    }
}

public class Ciind {
    public String getInCenk() {
        ...
    }
}

public class Cishing extends Brap {
    public List<Gred> getPsuns() {
        ...
    }
}

public class Cotreuc {
    public List<String> getViIi() {
        ...
    }
}

public class Gred {
    public byte[] getRefos() {
        ...
    }
}

public class Heien {
    public List<Tuson> getLaiuns() {
        ...
    }

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

public class Iastgned {
    public List<String> getLol() {
        ...
    }
}

public class Idmonk {
    public Qufil getWedo() {
        ...
    }

    public Ciind getArEress() {
        ...
    }

    public List<Neba> getScras() {
        ...
    }

    public List<Cotreuc> getRoDaesses() {
        ...
    }
}

public class Ludi {
    public List<String> getIss() {
        ...
    }
}

public class Mauup extends Purve {
    public int getErhe() {
        ...
    }
}

public class Neba extends Scheor {
    public Olpror getDuPi() {
        ...
    }
}

public class Oial {
    public byte[] getOgBuc() {
        ...
    }
}

public class Olpror {
    public String getElAurro() {
        ...
    }
}

public class Prea {
    public List<Cishing> getUsses() {
        ...
    }

    public int getChua() {
        ...
    }
}

public class Purve {
    public Idmonk getPoec() {
        ...
    }

    public int getPiapi() {
        ...
    }
}

public class Qufil extends Iastgned {
    public List<Oial> getRafels() {
        ...
    }
}

public class Scheor {
    public List<Trudol> getRers() {
        ...
    }

    public Prea getOuOtrii() {
        ...
    }
}

public class Thresarm extends Mauup {
    public int getEsmon() {
        ...
    }
}

public class Trudol {
    public String getPhidi() {
        ...
    }

    public Ludi getMibip() {
        ...
    }
}

public class Tuson {
    public Thresarm getPrass() {
        ...
    }

    public String getOtrio() {
        ...
    }
}
  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:

    Heien la

    ...and the following method:

    public void process(String item)

    ...write code to process the ceng of each uss of the first scra of each laiun of la.

    Solution

    for (Neba scra : la.getLaiuns().get(0).getPrass().getMauup().getPurve().getPoec().getScrasList()) {
        process(scra.getScheor().getOuOtrii().getUsses().get(0).getBrap().getCeng());
    }

Related puzzles: