Class relationships: Correct Solution


Consider the follow class declarations:

public class CilDescol extends Hiarm {
    public Rostil getOsa() {
        ...
    }
}

public class Douchi {
    public List<Trao> getOdPonnis() {
        ...
    }

    public Sient getCePoux() {
        ...
    }
}

public class Enpem {
    public File getCou() {
        ...
    }
}

public class Hiarm {
    public String getTrere() {
        ...
    }

    public int getBeScia() {
        ...
    }
}

public class Ihegs {
    public Leraund getAdBa() {
        ...
    }

    public List<Enpem> getVuchs() {
        ...
    }
}

public class Laph {
    public List<Prengphit> getScrases() {
        ...
    }

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

public class Leraund {
    public byte[] getTei() {
        ...
    }
}

public class Prengphit extends Sasio {
    public byte[] getTeu() {
        ...
    }
}

public class Rostil extends Ihegs {
    public String getTror() {
        ...
    }
}

public class Sasio {
    public Douchi getPhesi() {
        ...
    }

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

public class Sient {
    public int getClim() {
        ...
    }

    public List<CilDescol> getPsons() {
        ...
    }
}

public class Trao {
    public String getEnPomor() {
        ...
    }
}
  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:

    Laph wre

    ...and the following method:

    public void process(int item)

    ...write code to process the beScia of each pson of each scras of wre.

    Solution

    process(wre.getScrases().get(0).getSasio().getPhesi().getCePoux().getPsons().get(0).getHiarm().getBeScia());

Related puzzles: