Class relationships: Correct Solution


Consider the follow class declarations:

public class Croa {
    public String getHeFuist() {
        ...
    }
}

public class Fint {
    public byte[] getOol() {
        ...
    }
}

public class GlaPenas {
    public List<ScoAsgil> getCamdos() {
        ...
    }

    public Fint getEonid() {
        ...
    }
}

public class Norpa extends Saper {
    public int getEdIer() {
        ...
    }
}

public class Onia {
    public Norpa getBeConct() {
        ...
    }

    public String getCaMe() {
        ...
    }
}

public class Ownod {
    public String getBengs() {
        ...
    }

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

public class Phasi {
    public File getChrel() {
        ...
    }
}

public class PriSlathberd {
    public byte[] getEwha() {
        ...
    }
}

public class Saper extends PriSlathberd {
    public Croa getCiman() {
        ...
    }

    public List<GlaPenas> getPruls() {
        ...
    }

    public List<Phasi> getWoras() {
        ...
    }
}

public class ScoAsgil extends Ownod {
    public List<String> getHec() {
        ...
    }
}
  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:

    Onia poal

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the vont of each camdo of the first prul of poal.

    Solution

    for (GlaPenas prul : poal.getBeConct().getSaper().getPrulsList()) {
        process(prul.getCamdos().get(0).getOwnod().getVont());
    }

Related puzzles: