Class relationships: Correct Solution


Consider the follow class declarations:

public class Atgen extends Sareen {
    public Pitchmas getOchi() {
        ...
    }

    public List<Ewhuc> getBeEnts() {
        ...
    }
}

public class Dedca {
    public File getIea() {
        ...
    }
}

public class Ewhuc extends Poic {
    public File getReou() {
        ...
    }
}

public class Githchuin extends Rapa {
    public File getHiWo() {
        ...
    }
}

public class Mirpass {
    public List<Dedca> getChims() {
        ...
    }

    public int getBoeld() {
        ...
    }
}

public class NacHulol extends PniDoass {
    public File getOru() {
        ...
    }
}

public class Pitchmas {
    public byte[] getCido() {
        ...
    }

    public NacHulol getNes() {
        ...
    }
}

public class PniDoass {
    public String getGeba() {
        ...
    }
}

public class Poic {
    public Mirpass getEcja() {
        ...
    }

    public File getAsaul() {
        ...
    }
}

public class Rapa {
    public List<Wingprif> getSlisms() {
        ...
    }

    public File getDul() {
        ...
    }
}

public class RerEshem {
    public File getCes() {
        ...
    }

    public List<Githchuin> getFoSilpis() {
        ...
    }
}

public class Sahis {
    public RerEshem getAsSefo() {
        ...
    }

    public File getBeb() {
        ...
    }
}

public class Sareen {
    public byte[] getNari() {
        ...
    }

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

public class Senpas extends Sahis {
    public File getCeha() {
        ...
    }
}

public class Tripuap {
    public File getSeEcbi() {
        ...
    }

    public List<Atgen> getUsvods() {
        ...
    }
}

public class Wingprif {
    public String getAdMo() {
        ...
    }

    public Tripuap getAsmja() {
        ...
    }
}
  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:

    Senpas slua

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the ija of the first usvod of each slism of the first foSilpi of slua.

    Solution

    for (Githchuin foSilpi : slua.getSahis().getAsSefo().getFoSilpisList()) {
        for (Atgen usvod : foSilpi.getRapa().getSlisms().get(0).getAsmja().getUsvodsList()) {
            process(usvod.getSareen().getIja());
        }
    }

Related puzzles: