Class relationships: Correct Solution


Consider the follow class declarations:

public class AicDomni {
    public List<String> getOnco() {
        ...
    }
}

public class Bral {
    public String getBioss() {
        ...
    }
}

public class Canbil {
    public Bral getSiTeft() {
        ...
    }

    public List<Wouprern> getElnals() {
        ...
    }

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

public class Celen {
    public File getEol() {
        ...
    }
}

public class Changwho {
    public int getTaOu() {
        ...
    }

    public List<Eesssle> getConens() {
        ...
    }
}

public class Chefriw extends Drulkbus {
    public File getEhuld() {
        ...
    }
}

public class Ciodest extends Mesto {
    public Changwho getZedsi() {
        ...
    }
}

public class Drulkbus {
    public Canbil getVinse() {
        ...
    }

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

public class EckWhelstrish extends Meappring {
    public File getScrun() {
        ...
    }
}

public class Eesssle {
    public byte[] getRoNuss() {
        ...
    }
}

public class Eomvul {
    public Ustba getIassi() {
        ...
    }

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

public class FawOlgres {
    public List<Chefriw> getSisars() {
        ...
    }

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

public class Gelqo extends Plopilt {
    public Celen getHesm() {
        ...
    }
}

public class Griscoi {
    public AicDomni getEnt() {
        ...
    }

    public List<Eomvul> getSors() {
        ...
    }

    public FawOlgres getErPo() {
        ...
    }
}

public class Meappring {
    public int getMeEc() {
        ...
    }
}

public class Mesto {
    public List<String> getOunhu() {
        ...
    }

    public List<Griscoi> getIuEbas() {
        ...
    }
}

public class Nedud {
    public String getEwl() {
        ...
    }
}

public class Piolpros {
    public Tochi getPoas() {
        ...
    }

    public List<Nedud> getOwves() {
        ...
    }
}

public class Plopilt {
    public int getGror() {
        ...
    }

    public Velol getRir() {
        ...
    }
}

public class Tochi extends Gelqo {
    public int getCiUlpu() {
        ...
    }
}

public class Ustba {
    public byte[] getPless() {
        ...
    }
}

public class Velol {
    public List<String> getEsCiss() {
        ...
    }

    public List<Ciodest> getBeoucs() {
        ...
    }
}

public class Wepa {
    public List<Piolpros> getClius() {
        ...
    }

    public String getHuSti() {
        ...
    }
}

public class Wouprern extends EckWhelstrish {
    public File getUrcew() {
        ...
    }
}
  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:

    Wepa to

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the olae of each sisar of the first iuEba of the first beouc of the first cliu of to.

    Solution

    for (Piolpros cliu : to.getCliusList()) {
        for (Ciodest beouc : cliu.getPoas().getGelqo().getPlopilt().getRir().getBeoucsList()) {
            for (Griscoi iuEba : beouc.getMesto().getIuEbasList()) {
                process(iuEba.getErPo().getSisars().get(0).getDrulkbus().getVinse().getOlae());
            }
        }
    }

Related puzzles: