Class relationships: Correct Solution


Consider the follow class declarations:

public class BaoDeng {
    public List<Omout> getRous() {
        ...
    }

    public File getRhi() {
        ...
    }
}

public class Doeess {
    public File getLun() {
        ...
    }

    public Ocuac getMuDu() {
        ...
    }
}

public class Feven {
    public byte[] getSevic() {
        ...
    }
}

public class Gaedvan {
    public int getNeSe() {
        ...
    }
}

public class Grismte extends Nadsen {
    public List<Feven> getStuses() {
        ...
    }
}

public class Nadsen {
    public int getNiIo() {
        ...
    }
}

public class Ocuac {
    public List<String> getKasxu() {
        ...
    }

    public List<Praspsiss> getRiaos() {
        ...
    }
}

public class Omout {
    public QiaEal getCac() {
        ...
    }

    public String getPio() {
        ...
    }
}

public class Praspsiss extends Grismte {
    public String getAmMife() {
        ...
    }

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

public class QiaEal extends Doeess {
    public Gaedvan getSesm() {
        ...
    }
}
  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:

    BaoDeng a

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the ontac of each riao of the first rou of a.

    Solution

    for (Omout rou : a.getRousList()) {
        process(rou.getCac().getDoeess().getMuDu().getRiaos().get(0).getOntac());
    }

Related puzzles: