Class relationships: Correct Solution


Consider the follow class declarations:

public class AnxNewesm extends Teza {
    public Boted getMois() {
        ...
    }

    public Chre getDic() {
        ...
    }
}

public class Boted {
    public byte[] getKiEgres() {
        ...
    }

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

public class Cartgliork {
    public byte[] getAcSek() {
        ...
    }
}

public class Chre {
    public List<String> getCrior() {
        ...
    }
}

public class Deper extends SasOor {
    public File getCio() {
        ...
    }
}

public class Nouc {
    public List<Ossbem> getDoshs() {
        ...
    }

    public List<Pontcle> getUcos() {
        ...
    }
}

public class Ossbem {
    public List<Cartgliork> getCangs() {
        ...
    }

    public Deper getImOst() {
        ...
    }
}

public class Pontcle {
    public File getOdFim() {
        ...
    }
}

public class SasOor extends AnxNewesm {
    public File getPrai() {
        ...
    }
}

public class Teza {
    public int getHassi() {
        ...
    }
}
  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:

    Nouc ci

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the eed of the first dosh of ci.

    Solution

    for (Ossbem dosh : ci.getDoshsList()) {
        process(dosh.getImOst().getSasOor().getAnxNewesm().getMois().getEed());
    }

Related puzzles: