Class relationships: Correct Solution


Consider the follow class declarations:

public class Bocdoid {
    public File getGru() {
        ...
    }
}

public class Bolod extends Profa {
    public int getIlMi() {
        ...
    }

    public File getPrirn() {
        ...
    }
}

public class Eeces {
    public Bolod getArCu() {
        ...
    }

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

public class Irip {
    public List<PecRoidel> getTiosms() {
        ...
    }

    public List<Pror> getChrols() {
        ...
    }
}

public class Masmsen {
    public byte[] getReEmosh() {
        ...
    }
}

public class Mespe extends Pirdi {
    public List<Masmsen> getLoHeoses() {
        ...
    }
}

public class PecRoidel {
    public byte[] getDien() {
        ...
    }
}

public class Pirdi {
    public Irip getEmi() {
        ...
    }

    public Bocdoid getEsec() {
        ...
    }
}

public class Profa {
    public int getMeIs() {
        ...
    }
}

public class Pror extends Eeces {
    public String getWeosm() {
        ...
    }
}
  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:

    Mespe al

    ...and the following method:

    public void process(File item)

    ...write code to process the prirn of the first chrol of al.

    Solution

    for (Pror chrol : al.getPirdi().getEmi().getChrolsList()) {
        process(chrol.getEeces().getArCu().getPrirn());
    }

Related puzzles: