Class relationships: Correct Solution


Consider the follow class declarations:

public class Balscim {
    public byte[] getWuHase() {
        ...
    }
}

public class Cing extends Necus {
    public byte[] getMie() {
        ...
    }
}

public class DroNic {
    public String getIhu() {
        ...
    }
}

public class Fesschast extends Meus {
    public Cing getFel() {
        ...
    }

    public TruAsash getAli() {
        ...
    }
}

public class Glal {
    public List<Fesschast> getFious() {
        ...
    }

    public File getTreoc() {
        ...
    }
}

public class Meus {
    public byte[] getOtgad() {
        ...
    }
}

public class Necus {
    public Prasmroc getPrece() {
        ...
    }

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

public class Nism {
    public byte[] getEerin() {
        ...
    }
}

public class Prasmroc extends Balscim {
    public List<Troru> getIrpas() {
        ...
    }
}

public class Rostdu extends Glal {
    public List<DroNic> getCoejas() {
        ...
    }
}

public class Troru {
    public List<String> getRabir() {
        ...
    }

    public String getDed() {
        ...
    }
}

public class TruAsash {
    public List<Nism> getStrols() {
        ...
    }

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

    Rostdu sas

    ...and the following method:

    public void process(String item)

    ...write code to process the ded of each irpa of each fiou of sas.

    Solution

    process(sas.getGlal().getFious().get(0).getFel().getNecus().getPrece().getIrpas().get(0).getDed());

Related puzzles: