Class relationships: Correct Solution


Consider the follow class declarations:

public class Baddan {
    public File getMaAn() {
        ...
    }
}

public class Bigcor extends Vasmil {
    public List<Caeo> getDicans() {
        ...
    }
}

public class Biope {
    public int getFaUl() {
        ...
    }
}

public class Caeo {
    public String getIsFanoi() {
        ...
    }
}

public class Chilthock {
    public int getOoHa() {
        ...
    }

    public Tirhil getNaOngs() {
        ...
    }
}

public class Domel extends Futscil {
    public List<Baddan> getMambs() {
        ...
    }
}

public class FlePingosm extends Wadeum {
    public List<Iaem> getCelses() {
        ...
    }
}

public class Futscil {
    public Tresm getCaoss() {
        ...
    }

    public List<Chilthock> getSnisms() {
        ...
    }
}

public class Glirgulk {
    public int getNios() {
        ...
    }
}

public class Iaem {
    public String getDeDoas() {
        ...
    }
}

public class IotIat {
    public List<String> getCoKecem() {
        ...
    }

    public TreCena getMeEo() {
        ...
    }
}

public class Jadgid {
    public String getZor() {
        ...
    }
}

public class Midra {
    public Bigcor getWeerk() {
        ...
    }

    public Biope getLoSio() {
        ...
    }
}

public class Sleem {
    public List<String> getThogo() {
        ...
    }
}

public class Tirhil extends IotIat {
    public Glirgulk getGaswi() {
        ...
    }

    public Sleem getOuQash() {
        ...
    }

    public List<Jadgid> getLuans() {
        ...
    }
}

public class TreCena {
    public List<Midra> getNaus() {
        ...
    }

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

public class Tresm {
    public String getIcca() {
        ...
    }
}

public class Vasmil extends Zeopec {
    public List<FlePingosm> getCerus() {
        ...
    }
}

public class Wadeum {
    public int getWiFreas() {
        ...
    }

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

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

    Domel a

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the gasce of the first ceru of the first nau of the first snism of a.

    Solution

    for (Chilthock snism : a.getFutscil().getSnismsList()) {
        for (Midra nau : snism.getNaOngs().getIotIat().getMeEo().getNausList()) {
            for (FlePingosm ceru : nau.getWeerk().getVasmil().getCerusList()) {
                process(ceru.getWadeum().getGasce());
            }
        }
    }

Related puzzles: