Class relationships: Correct Solution


Consider the follow class declarations:

public class Biul extends DokRoag {
    public int getOurl() {
        ...
    }
}

public class CacSucmit {
    public String getJefek() {
        ...
    }

    public ThiPeder getSarla() {
        ...
    }
}

public class DokRoag extends PecUwus {
    public Gichoss getDipe() {
        ...
    }
}

public class Gichoss {
    public List<Plenswas> getKelis() {
        ...
    }

    public List<CacSucmit> getRaawls() {
        ...
    }
}

public class PecUwus {
    public int getSpant() {
        ...
    }
}

public class Plenswas {
    public byte[] getPhen() {
        ...
    }

    public RarDenprem getTre() {
        ...
    }
}

public class RarDenprem {
    public List<String> getEale() {
        ...
    }
}

public class ThiPeder {
    public byte[] getBaid() {
        ...
    }

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

    Biul e

    ...and the following method:

    public void process(int item)

    ...write code to process the sango of the first raawl of e.

    Solution

    for (CacSucmit raawl : e.getDokRoag().getDipe().getRaawlsList()) {
        process(raawl.getSarla().getSango());
    }

Related puzzles: