Class relationships: Correct Solution


Consider the follow class declarations:

public class Chouo extends Ulpror {
    public String getPhesh() {
        ...
    }

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

public class Nasil extends Scadsa {
    public List<Peosnac> getPrors() {
        ...
    }

    public NirEssweant getQean() {
        ...
    }
}

public class NirEssweant {
    public List<String> getIrip() {
        ...
    }
}

public class Peosnac {
    public byte[] getHeol() {
        ...
    }
}

public class Scadsa {
    public byte[] getRuel() {
        ...
    }

    public Ucga getRoGlun() {
        ...
    }
}

public class Sturwel extends Chouo {
    public int getPiei() {
        ...
    }
}

public class Ucga {
    public byte[] getSqin() {
        ...
    }

    public List<Sturwel> getBoels() {
        ...
    }
}

public class Ulpror {
    public List<String> getOuan() {
        ...
    }
}
  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:

    Nasil ehul

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the veclo of each boel of ehul.

    Solution

    process(ehul.getScadsa().getRoGlun().getBoels().get(0).getChouo().getVeclo());

Related puzzles: