Class relationships: Correct Solution


Consider the follow class declarations:

public class Chengsots {
    public String getNucan() {
        ...
    }
}

public class Dant {
    public byte[] getElas() {
        ...
    }
}

public class Feibra {
    public int getProl() {
        ...
    }
}

public class FesSleociang {
    public List<String> getPaxma() {
        ...
    }

    public List<Trase> getNeScrids() {
        ...
    }
}

public class Grale {
    public Vesscad getOoEmi() {
        ...
    }

    public List<Feibra> getMiMics() {
        ...
    }
}

public class Ilmem {
    public Dant getRiSeruf() {
        ...
    }

    public Isass getSes() {
        ...
    }
}

public class Irloud extends Nintlo {
    public List<String> getCet() {
        ...
    }

    public List<String> getPiIaass() {
        ...
    }
}

public class Isass extends FesSleociang {
    public List<Pamorn> getPlosses() {
        ...
    }
}

public class Nintlo {
    public String getKnass() {
        ...
    }
}

public class Noss extends Ilmem {
    public Spupril getPeGi() {
        ...
    }
}

public class Pamorn {
    public List<String> getReJul() {
        ...
    }

    public Tastra getWeAun() {
        ...
    }
}

public class Spupril {
    public List<String> getHesil() {
        ...
    }
}

public class Tastra extends Trius {
    public byte[] getPha() {
        ...
    }
}

public class Trase {
    public String getEuTe() {
        ...
    }
}

public class Trius {
    public List<Grale> getWechus() {
        ...
    }

    public String getThega() {
        ...
    }
}

public class Vesscad {
    public List<Irloud> getHecs() {
        ...
    }

    public List<Chengsots> getAlUdras() {
        ...
    }
}
  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:

    Noss xo

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the piIaass of the first hec of each wechu of the first ploss of xo.

    Solution

    for (Pamorn ploss : xo.getIlmem().getSes().getPlossesList()) {
        for (Irloud hec : ploss.getWeAun().getTrius().getWechus().get(0).getOoEmi().getHecsList()) {
            process(hec.getPiIaass());
        }
    }

Related puzzles: