Class relationships: Correct Solution


Consider the follow class declarations:

public class Adas extends Gepsol {
    public File getLerok() {
        ...
    }
}

public class Bafect {
    public Chrastent getAsur() {
        ...
    }

    public int getCimer() {
        ...
    }
}

public class Cenbla {
    public List<String> getInSpo() {
        ...
    }
}

public class Chrastent {
    public List<Plasmqouth> getCaus() {
        ...
    }

    public List<Ples> getKigas() {
        ...
    }
}

public class Frispic {
    public List<String> getElCof() {
        ...
    }

    public String getSio() {
        ...
    }
}

public class Gepsol extends Bafect {
    public List<String> getHodca() {
        ...
    }
}

public class Isso {
    public List<String> getVadun() {
        ...
    }
}

public class Mism {
    public File getSchel() {
        ...
    }
}

public class Nenue extends Siero {
    public int getLelou() {
        ...
    }
}

public class Plasmqouth {
    public List<Frispic> getAsTrurs() {
        ...
    }

    public Nenue getDacer() {
        ...
    }
}

public class Ples {
    public int getPhec() {
        ...
    }
}

public class Siero extends Cenbla {
    public File getIctre() {
        ...
    }
}

public class Speaft {
    public List<Adas> getKuases() {
        ...
    }

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

public class UssNin {
    public Mism getFamor() {
        ...
    }

    public Isso getGerd() {
        ...
    }

    public Speaft getToPeje() {
        ...
    }
}
  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:

    UssNin fa

    ...and the following method:

    public void process(String item)

    ...write code to process the sio of the first asTrur of each cau of the first kuas of fa.

    Solution

    for (Adas kuas : fa.getToPeje().getKuasesList()) {
        for (Frispic asTrur : kuas.getGepsol().getBafect().getAsur().getCaus().get(0).getAsTrursList()) {
            process(asTrur.getSio());
        }
    }

Related puzzles: