Class relationships: Correct Solution


Consider the follow class declarations:

public class Aenmed extends Tiroc {
    public List<Scront> getSiPlas() {
        ...
    }
}

public class Bosbi {
    public List<String> getIdOll() {
        ...
    }
}

public class Clul extends Uein {
    public String getEnt() {
        ...
    }
}

public class Duas {
    public String getOrAicwe() {
        ...
    }
}

public class Egai {
    public Bosbi getMedo() {
        ...
    }

    public List<Aenmed> getTruls() {
        ...
    }
}

public class Erlon {
    public Clul getCies() {
        ...
    }

    public List<Duas> getOcras() {
        ...
    }
}

public class Frant {
    public List<String> getKismi() {
        ...
    }
}

public class NocPeb {
    public int getEomes() {
        ...
    }
}

public class Phes {
    public Egai getUssu() {
        ...
    }

    public int getLiAtch() {
        ...
    }
}

public class PioRecal extends Phes {
    public List<Telless> getPlaes() {
        ...
    }
}

public class QenBenouc extends Frant {
    public List<PioRecal> getNidios() {
        ...
    }
}

public class Scront {
    public String getMiFaad() {
        ...
    }
}

public class Shoullner {
    public String getPra() {
        ...
    }
}

public class Telless {
    public int getIhal() {
        ...
    }
}

public class Tiroc {
    public NocPeb getRup() {
        ...
    }

    public Erlon getCus() {
        ...
    }
}

public class Uein extends Shoullner {
    public List<String> getMinea() {
        ...
    }

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

    QenBenouc sas

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the cuNo of the first trul of the first nidio of sas.

    Solution

    for (PioRecal nidio : sas.getNidiosList()) {
        for (Aenmed trul : nidio.getPhes().getUssu().getTrulsList()) {
            process(trul.getTiroc().getCus().getCies().getUein().getCuNo());
        }
    }

Related puzzles: