Class relationships: Correct Solution


Consider the follow class declarations:

public class Ceoc extends Prateng {
    public int getIsnan() {
        ...
    }
}

public class Cerg extends Spess {
    public int getCoBanra() {
        ...
    }
}

public class Cudgi extends Prir {
    public File getDonre() {
        ...
    }
}

public class Ecal extends Cerg {
    public List<ErmItchden> getEsusses() {
        ...
    }
}

public class Ecne {
    public File getMaRiom() {
        ...
    }
}

public class ErmItchden extends OssGeghrha {
    public Ecne getRuStror() {
        ...
    }

    public List<Podcorm> getPsus() {
        ...
    }
}

public class Erping {
    public int getIin() {
        ...
    }
}

public class Gossmiouc {
    public String getToasm() {
        ...
    }

    public List<Vacklan> getGeSos() {
        ...
    }
}

public class Gume {
    public List<Ecal> getGnems() {
        ...
    }

    public String getNeInth() {
        ...
    }
}

public class Ichosm {
    public List<Zossess> getIsgas() {
        ...
    }

    public Poirmint getSpio() {
        ...
    }
}

public class IcoErfuxt {
    public Cudgi getOlRir() {
        ...
    }

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

public class Kepsos extends Erping {
    public Gossmiouc getEes() {
        ...
    }

    public List<IcoErfuxt> getThoots() {
        ...
    }
}

public class OssGeghrha {
    public byte[] getNer() {
        ...
    }
}

public class Phanggrat {
    public List<String> getFuRer() {
        ...
    }
}

public class Podcorm {
    public List<String> getRoick() {
        ...
    }
}

public class Poirmint extends Phanggrat {
    public byte[] getIknui() {
        ...
    }
}

public class Prateng {
    public Ichosm getIik() {
        ...
    }

    public String getSkia() {
        ...
    }
}

public class Prir {
    public Schephprec getJibor() {
        ...
    }

    public List<Ceoc> getAdels() {
        ...
    }
}

public class Schephprec {
    public String getWesse() {
        ...
    }
}

public class Spess {
    public String getSiOnpi() {
        ...
    }

    public Kepsos getUpi() {
        ...
    }
}

public class Sphia {
    public Gume getHeDaar() {
        ...
    }

    public int getErBotil() {
        ...
    }
}

public class Tenid {
    public int getEdIdi() {
        ...
    }
}

public class Vacklan {
    public String getElmed() {
        ...
    }
}

public class Zossess {
    public List<Tenid> getThris() {
        ...
    }

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

    public int getEnRepe() {
        ...
    }
}
  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:

    Sphia ti

    ...and the following method:

    public void process(int item)

    ...write code to process the enRepe of each isga of each adel of each thoot of the first gnem of ti.

    Solution

    for (Ecal gnem : ti.getHeDaar().getGnemsList()) {
        process(gnem.getCerg().getSpess().getUpi().getThoots().get(0).getOlRir().getPrir().getAdels().get(0).getPrateng().getIik().getIsgas().get(0).getEnRepe());
    }

Related puzzles: