Class relationships: Correct Solution


Consider the follow class declarations:

public class Dardsin extends NiiAghtuess {
    public List<String> getIosto() {
        ...
    }
}

public class Eban {
    public List<String> getOaScer() {
        ...
    }

    public List<Lidbar> getOsUds() {
        ...
    }
}

public class Frevand {
    public List<Eban> getTroas() {
        ...
    }

    public List<Uanci> getOdFres() {
        ...
    }
}

public class Lidbar {
    public List<String> getArCioss() {
        ...
    }

    public Petain getInsu() {
        ...
    }
}

public class NiiAghtuess extends Tirga {
    public int getLil() {
        ...
    }
}

public class Petain {
    public byte[] getUdod() {
        ...
    }

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

public class Phennen extends Frevand {
    public Dardsin getDisae() {
        ...
    }
}

public class SekTir {
    public Phennen getPror() {
        ...
    }

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

public class Tirga {
    public byte[] getCiFiit() {
        ...
    }
}

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

    SekTir iurd

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the irMi of the first osUd of the first troa of iurd.

    Solution

    for (Eban troa : iurd.getPror().getFrevand().getTroasList()) {
        for (Lidbar osUd : troa.getOsUdsList()) {
            process(osUd.getInsu().getIrMi());
        }
    }

Related puzzles: