Class relationships: Correct Solution


Consider the follow class declarations:

public class Bastmin {
    public int getLeJa() {
        ...
    }
}

public class FoaCadrol {
    public Schi getOiAlri() {
        ...
    }

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

public class Jecru {
    public Rermne getFif() {
        ...
    }

    public List<String> getDaNoss() {
        ...
    }
}

public class Mengchesm {
    public String getAesbo() {
        ...
    }
}

public class Rermne extends FoaCadrol {
    public List<Mengchesm> getCuris() {
        ...
    }
}

public class Schi extends Bastmin {
    public List<Schosseae> getSlecs() {
        ...
    }

    public int getEdVi() {
        ...
    }
}

public class Schosseae {
    public List<String> getPochi() {
        ...
    }
}

public class Sphusta {
    public File getCimad() {
        ...
    }

    public List<Jecru> getMePenads() {
        ...
    }
}
  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:

    Sphusta riar

    ...and the following method:

    public void process(int item)

    ...write code to process the edVi of the first mePenad of riar.

    Solution

    for (Jecru mePenad : riar.getMePenadsList()) {
        process(mePenad.getFif().getFoaCadrol().getOiAlri().getEdVi());
    }

Related puzzles: