Class relationships: Correct Solution


Consider the follow class declarations:

public class Bauer {
    public int getSas() {
        ...
    }
}

public class CemNesse extends Flaen {
    public String getVuere() {
        ...
    }
}

public class Chec {
    public int getVont() {
        ...
    }
}

public class Dengmin extends Psiner {
    public Bauer getCing() {
        ...
    }

    public Oucall getCoro() {
        ...
    }
}

public class Eamjing {
    public String getIlSelgi() {
        ...
    }
}

public class Flaen {
    public Hohes getVeed() {
        ...
    }

    public byte[] getMai() {
        ...
    }
}

public class Gima {
    public int getCaPlon() {
        ...
    }
}

public class Hohes {
    public List<Spii> getNelens() {
        ...
    }

    public Iaas getInIod() {
        ...
    }
}

public class Honted {
    public String getCeSeso() {
        ...
    }

    public List<CemNesse> getVirs() {
        ...
    }
}

public class Hostis {
    public List<Striphpu> getMeOtwis() {
        ...
    }

    public int getPrus() {
        ...
    }
}

public class Iaas {
    public List<Lorom> getAeJeses() {
        ...
    }

    public List<Measi> getDuPosus() {
        ...
    }
}

public class Ingra {
    public List<String> getAcOlfib() {
        ...
    }

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

public class IomFola extends Pussbing {
    public String getBucou() {
        ...
    }
}

public class Lempel extends Chec {
    public byte[] getEcAs() {
        ...
    }
}

public class Lorom {
    public List<String> getReOe() {
        ...
    }
}

public class Measi extends Sphea {
    public byte[] getNia() {
        ...
    }
}

public class Oucall {
    public List<String> getPanor() {
        ...
    }
}

public class Pimoc extends Gima {
    public Lempel getEdPtass() {
        ...
    }

    public Ingra getEstil() {
        ...
    }
}

public class Psiner {
    public File getCiEcpal() {
        ...
    }

    public Hostis getDed() {
        ...
    }
}

public class Pussbing {
    public byte[] getHos() {
        ...
    }
}

public class Sphea {
    public List<Sueshrunt> getEnpros() {
        ...
    }

    public List<Dengmin> getOnHus() {
        ...
    }
}

public class Spii {
    public List<String> getDiooc() {
        ...
    }
}

public class Striphpu extends Pimoc {
    public Eamjing getIxle() {
        ...
    }

    public List<IomFola> getSerous() {
        ...
    }
}

public class Sueshrunt {
    public String getHoPemer() {
        ...
    }
}
  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:

    Honted gak

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the gec of the first meOtwi of the first onHu of each duPosu of each vir of gak.

    Solution

    for (Dengmin onHu : gak.getVirs().get(0).getFlaen().getVeed().getInIod().getDuPosus().get(0).getSphea().getOnHusList()) {
        for (Striphpu meOtwi : onHu.getPsiner().getDed().getMeOtwisList()) {
            process(meOtwi.getPimoc().getEstil().getGec());
        }
    }

Related puzzles: