Class relationships: Correct Solution


Consider the follow class declarations:

public class Carra {
    public int getEpCrer() {
        ...
    }
}

public class DreUol extends Shichroc {
    public String getProbo() {
        ...
    }
}

public class Prar extends SteThreng {
    public Sposm getCuAsag() {
        ...
    }

    public int getAci() {
        ...
    }
}

public class Shichroc extends Taire {
    public String getSusbe() {
        ...
    }
}

public class SioDri {
    public String getPedpa() {
        ...
    }
}

public class Sposm {
    public List<SioDri> getPeJermes() {
        ...
    }

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

public class SteThreng {
    public String getFrar() {
        ...
    }
}

public class Stidchad {
    public Carra getOnNi() {
        ...
    }

    public List<Tismjes> getRiVos() {
        ...
    }
}

public class Taire {
    public int getGrils() {
        ...
    }

    public List<Prar> getMuActis() {
        ...
    }
}

public class Tismjes {
    public DreUol getIedme() {
        ...
    }

    public int getDonra() {
        ...
    }
}
  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:

    Stidchad dimb

    ...and the following method:

    public void process(int item)

    ...write code to process the aci of each muActi of the first riVo of dimb.

    Solution

    for (Tismjes riVo : dimb.getRiVosList()) {
        process(riVo.getIedme().getShichroc().getTaire().getMuActis().get(0).getAci());
    }

Related puzzles: