Class relationships: Correct Solution


Consider the follow class declarations:

public class Duechren {
    public Woswrio getBiPiwn() {
        ...
    }

    public RaeSticu getNudel() {
        ...
    }

    public List<Eght> getLoZas() {
        ...
    }
}

public class Eght {
    public String getDood() {
        ...
    }

    public Ocpel getLolpo() {
        ...
    }
}

public class Gephe extends Tror {
    public File getJoup() {
        ...
    }
}

public class Jiacaun {
    public List<Whatost> getStrins() {
        ...
    }

    public String getEnu() {
        ...
    }
}

public class Mesprod {
    public byte[] getErmod() {
        ...
    }
}

public class Mudstan {
    public String getPocca() {
        ...
    }

    public Uldi getVaPu() {
        ...
    }
}

public class Nolic extends Taho {
    public Utthes getCeng() {
        ...
    }
}

public class Ocpel extends Gephe {
    public String getCalpu() {
        ...
    }
}

public class Piomul {
    public List<String> getClia() {
        ...
    }
}

public class RaeSticu extends Mesprod {
    public List<Piomul> getFlefas() {
        ...
    }
}

public class Reston {
    public List<String> getPaMeke() {
        ...
    }
}

public class SasCadnid {
    public String getTios() {
        ...
    }

    public Duechren getArned() {
        ...
    }
}

public class Sias {
    public byte[] getChopo() {
        ...
    }
}

public class Taho {
    public List<SasCadnid> getEdSus() {
        ...
    }

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

public class TiaKnecseew extends Reston {
    public List<Jiacaun> getGacus() {
        ...
    }

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

public class Tror {
    public List<Mudstan> getOsts() {
        ...
    }

    public int getPra() {
        ...
    }
}

public class Uldi extends TiaKnecseew {
    public File getIrDiart() {
        ...
    }
}

public class Utthes extends Sias {
    public byte[] getFui() {
        ...
    }
}

public class Whatost {
    public String getAoVi() {
        ...
    }
}

public class Woswrio {
    public File getEoo() {
        ...
    }
}
  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:

    Nolic tac

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the enEnt of the first ost of the first loZa of the first edSu of tac.

    Solution

    for (SasCadnid edSu : tac.getTaho().getEdSusList()) {
        for (Eght loZa : edSu.getArned().getLoZasList()) {
            for (Mudstan ost : loZa.getLolpo().getGephe().getTror().getOstsList()) {
                process(ost.getVaPu().getTiaKnecseew().getEnEnt());
            }
        }
    }

Related puzzles: