Class relationships: Correct Solution


Consider the follow class declarations:

public class Aever extends Gethve {
    public File getTeo() {
        ...
    }
}

public class Cefal {
    public File getHeri() {
        ...
    }

    public String getAun() {
        ...
    }
}

public class Cergin {
    public String getGiren() {
        ...
    }
}

public class Ciri extends HacIss {
    public Raler getShadi() {
        ...
    }
}

public class Eckclir {
    public List<Fleress> getOcSas() {
        ...
    }

    public List<Aever> getAcsims() {
        ...
    }
}

public class Fleress {
    public int getVad() {
        ...
    }
}

public class Gethve {
    public Pimor getSodzi() {
        ...
    }

    public File getSiSas() {
        ...
    }
}

public class HacIss extends Mansces {
    public List<Sossfew> getInbres() {
        ...
    }

    public Loass getPel() {
        ...
    }
}

public class Hosh {
    public String getCebe() {
        ...
    }
}

public class HucIsscil {
    public int getHudo() {
        ...
    }
}

public class Lescru {
    public byte[] getBua() {
        ...
    }
}

public class Loass extends HucIsscil {
    public String getCip() {
        ...
    }
}

public class Mansces extends Whoftkong {
    public byte[] getMeel() {
        ...
    }
}

public class NenBrecaul {
    public Siard getBadi() {
        ...
    }

    public File getQin() {
        ...
    }
}

public class Olbund {
    public List<SefEntweu> getCecks() {
        ...
    }

    public String getHonin() {
        ...
    }
}

public class Pimor extends Olbund {
    public List<String> getBitan() {
        ...
    }
}

public class Plimon {
    public String getIbre() {
        ...
    }
}

public class Raler {
    public List<Cergin> getPeaers() {
        ...
    }

    public File getFaWodin() {
        ...
    }
}

public class Seaef {
    public byte[] getDiMowia() {
        ...
    }
}

public class SefEntweu {
    public Lescru getGiSuslu() {
        ...
    }

    public List<Seaef> getFrids() {
        ...
    }

    public NenBrecaul getLogh() {
        ...
    }

    public Plimon getIoss() {
        ...
    }
}

public class Siard {
    public String getLeRu() {
        ...
    }

    public List<WocPhe> getHuens() {
        ...
    }
}

public class Sossfew {
    public Eckclir getItId() {
        ...
    }

    public File getTiss() {
        ...
    }
}

public class Whoftkong {
    public byte[] getUsm() {
        ...
    }
}

public class WocPhe extends Cefal {
    public List<Hosh> getEnTis() {
        ...
    }
}
  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:

    Ciri phad

    ...and the following method:

    public void process(String item)

    ...write code to process the aun of the first huen of the first ceck of the first acsim of the first inbre of phad.

    Solution

    for (Sossfew inbre : phad.getHacIss().getInbresList()) {
        for (Aever acsim : inbre.getItId().getAcsimsList()) {
            for (SefEntweu ceck : acsim.getGethve().getSodzi().getOlbund().getCecksList()) {
                for (WocPhe huen : ceck.getLogh().getBadi().getHuensList()) {
                    process(huen.getCefal().getAun());
                }
            }
        }
    }

Related puzzles: