Class relationships: Correct Solution


Consider the follow class declarations:

public class CilTheousel {
    public int getPiani() {
        ...
    }
}

public class Cinaet {
    public byte[] getPri() {
        ...
    }
}

public class Gibloa {
    public int getInMup() {
        ...
    }

    public Mour getPuda() {
        ...
    }
}

public class Isplian {
    public Gibloa getFoLocs() {
        ...
    }

    public String getWison() {
        ...
    }
}

public class Kask extends Isplian {
    public List<Molren> getCiEhies() {
        ...
    }
}

public class Molren {
    public int getUaEpse() {
        ...
    }

    public Resi getMeOac() {
        ...
    }
}

public class Mour extends CilTheousel {
    public List<Pher> getOslis() {
        ...
    }
}

public class Pher extends Cinaet {
    public byte[] getOnu() {
        ...
    }

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

public class Resi {
    public List<String> getPaOr() {
        ...
    }
}

public class Stulcush {
    public String getCaTraas() {
        ...
    }

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

    Stulcush od

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the taIsu of the first osli of each idvod of od.

    Solution

    for (Pher osli : od.getIdvods().get(0).getIsplian().getFoLocs().getPuda().getOslisList()) {
        process(osli.getTaIsu());
    }

Related puzzles: