Class relationships: Correct Solution


Consider the follow class declarations:

public class Aswit {
    public Cillbou getNiont() {
        ...
    }

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

public class Bioc {
    public List<String> getNiol() {
        ...
    }
}

public class Cillbou {
    public byte[] getJada() {
        ...
    }
}

public class Cissce {
    public Niap getOsda() {
        ...
    }

    public Steba getRiama() {
        ...
    }
}

public class Darch {
    public List<String> getGradi() {
        ...
    }
}

public class Kouc {
    public List<Pledios> getRaMos() {
        ...
    }

    public List<Bioc> getTioses() {
        ...
    }
}

public class Leru extends Aswit {
    public Cissce getDasa() {
        ...
    }
}

public class Niap {
    public List<Wewau> getFlods() {
        ...
    }

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

public class OmeApsa {
    public List<String> getCouc() {
        ...
    }

    public List<Leru> getAnEcjus() {
        ...
    }
}

public class Phesess {
    public int getVir() {
        ...
    }
}

public class Pledios {
    public List<String> getEdVafro() {
        ...
    }

    public Tesmto getSeOn() {
        ...
    }

    public File getNobo() {
        ...
    }
}

public class Proicfim extends OmeApsa {
    public List<Darch> getOmsles() {
        ...
    }
}

public class Steba extends Phesess {
    public int getAnad() {
        ...
    }
}

public class Tesmto {
    public List<String> getIsler() {
        ...
    }
}

public class Wewau extends Zorpam {
    public List<String> getScuud() {
        ...
    }
}

public class Zorpam extends Kouc {
    public List<String> getSpe() {
        ...
    }
}
  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:

    Proicfim o

    ...and the following method:

    public void process(File item)

    ...write code to process the nobo of each raMo of the first flod of the first anEcju of o.

    Solution

    for (Leru anEcju : o.getOmeApsa().getAnEcjusList()) {
        for (Wewau flod : anEcju.getDasa().getOsda().getFlodsList()) {
            process(flod.getZorpam().getKouc().getRaMos().get(0).getNobo());
        }
    }

Related puzzles: