Class relationships: Correct Solution


Consider the follow class declarations:

public class Apal {
    public String getZassi() {
        ...
    }
}

public class Estkegn {
    public String getKawo() {
        ...
    }

    public List<Leinenk> getGaEesses() {
        ...
    }
}

public class Leinenk {
    public int getDosh() {
        ...
    }

    public List<Oble> getCabises() {
        ...
    }
}

public class NasDeiarm {
    public List<Apal> getCoWaus() {
        ...
    }

    public Estkegn getNii() {
        ...
    }
}

public class Nedtioun {
    public File getNoct() {
        ...
    }
}

public class Oble extends Thrissiad {
    public Nedtioun getDosm() {
        ...
    }

    public String getPaQi() {
        ...
    }
}

public class Ongsi extends NasDeiarm {
    public String getJoue() {
        ...
    }
}

public class Thrissiad {
    public int getEiDa() {
        ...
    }
}
  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:

    Ongsi ou

    ...and the following method:

    public void process(String item)

    ...write code to process the paQi of each cabis of the first gaEess of ou.

    Solution

    for (Leinenk gaEess : ou.getNasDeiarm().getNii().getGaEessesList()) {
        process(gaEess.getCabises().get(0).getPaQi());
    }

Related puzzles: