Class relationships: Correct Solution


Consider the follow class declarations:

public class Ansist {
    public List<String> getCuc() {
        ...
    }
}

public class ArdVessos {
    public List<Strosou> getLulocs() {
        ...
    }

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

public class Armhosh {
    public String getRoitz() {
        ...
    }
}

public class Gietso extends Naplal {
    public List<String> getIshin() {
        ...
    }
}

public class Kendvir extends Ansist {
    public List<Lacog> getFrals() {
        ...
    }

    public Strestrur getBeph() {
        ...
    }
}

public class Lacog {
    public List<Armhosh> getWaKoisses() {
        ...
    }

    public ArdVessos getCicui() {
        ...
    }
}

public class Naplal {
    public Kendvir getMui() {
        ...
    }

    public File getVecha() {
        ...
    }
}

public class Pocran {
    public File getIobar() {
        ...
    }
}

public class Strestrur extends Pocran {
    public byte[] getHar() {
        ...
    }
}

public class Strosou {
    public File getNean() {
        ...
    }

    public byte[] getErVempe() {
        ...
    }
}
  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:

    Gietso dovu

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the erVempe of the first luloc of the first fral of dovu.

    Solution

    for (Lacog fral : dovu.getNaplal().getMui().getFralsList()) {
        for (Strosou luloc : fral.getCicui().getLulocsList()) {
            process(luloc.getErVempe());
        }
    }

Related puzzles: