Class relationships: Correct Solution


Consider the follow class declarations:

public class Besrar {
    public File getAoEfo() {
        ...
    }
}

public class Ceun extends Sadmiost {
    public int getChrad() {
        ...
    }
}

public class Dooss {
    public String getUdWi() {
        ...
    }
}

public class Panceff {
    public List<String> getHeAm() {
        ...
    }
}

public class Peae {
    public byte[] getJid() {
        ...
    }
}

public class PniCinkhar {
    public List<Unju> getMinons() {
        ...
    }

    public List<WiaEapind> getMewoos() {
        ...
    }
}

public class Prolsess extends PniCinkhar {
    public File getUsal() {
        ...
    }
}

public class Sadmiost {
    public List<String> getKac() {
        ...
    }

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

public class Shiss {
    public Panceff getRaa() {
        ...
    }

    public Ceun getRar() {
        ...
    }
}

public class Unju extends Peae {
    public List<String> getCaEr() {
        ...
    }
}

public class WiaEapind {
    public Wopio getMuEssce() {
        ...
    }

    public File getLoIrgo() {
        ...
    }
}

public class Wopio {
    public List<Shiss> getPiTes() {
        ...
    }

    public List<Besrar> getTiIns() {
        ...
    }

    public Dooss getHodro() {
        ...
    }
}
  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:

    Prolsess cros

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the veft of the first piTe of each mewoo of cros.

    Solution

    for (Shiss piTe : cros.getPniCinkhar().getMewoos().get(0).getMuEssce().getPiTesList()) {
        process(piTe.getRar().getSadmiost().getVeft());
    }

Related puzzles: