Class relationships: Correct Solution


Consider the follow class declarations:

public class AngEnt extends Hiber {
    public List<String> getCasio() {
        ...
    }
}

public class Anha {
    public File getFrifa() {
        ...
    }

    public Tios getViLuad() {
        ...
    }
}

public class Arlas {
    public byte[] getWhis() {
        ...
    }
}

public class Flou {
    public String getAlSomu() {
        ...
    }

    public List<Anha> getExhos() {
        ...
    }

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

public class GuaTulsce {
    public String getSaEl() {
        ...
    }
}

public class Hiber {
    public List<Osig> getEnBodres() {
        ...
    }

    public List<Prucell> getBrepis() {
        ...
    }

    public Arlas getOnEsae() {
        ...
    }
}

public class Honpir extends Pepian {
    public List<String> getBir() {
        ...
    }
}

public class Osig {
    public byte[] getEnmis() {
        ...
    }
}

public class Pepian extends GuaTulsce {
    public Flou getAbXesm() {
        ...
    }
}

public class Prucell {
    public List<String> getGolce() {
        ...
    }

    public Trasstroo getHeAd() {
        ...
    }
}

public class Tios {
    public File getPris() {
        ...
    }
}

public class Trasstroo {
    public String getRaSeded() {
        ...
    }

    public List<Honpir> getClas() {
        ...
    }
}
  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:

    AngEnt leqo

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the kiFaeg of each cla of the first brepi of leqo.

    Solution

    for (Prucell brepi : leqo.getHiber().getBrepisList()) {
        process(brepi.getHeAd().getClas().get(0).getPepian().getAbXesm().getKiFaeg());
    }

Related puzzles: