Class relationships: Correct Solution


Consider the follow class declarations:

public class Brur extends Marwir {
    public byte[] getOrDiti() {
        ...
    }
}

public class Callaet {
    public List<String> getHifal() {
        ...
    }
}

public class Castass {
    public int getTeGuen() {
        ...
    }

    public Olsti getIrDi() {
        ...
    }
}

public class Clanmi {
    public Stri getMiEr() {
        ...
    }

    public int getEuh() {
        ...
    }
}

public class Eendud {
    public byte[] getCispi() {
        ...
    }

    public List<Brur> getIdis() {
        ...
    }
}

public class EniThrer extends Oucau {
    public List<Hesso> getOlos() {
        ...
    }
}

public class Hesso {
    public byte[] getGnuo() {
        ...
    }

    public Mebre getDeiss() {
        ...
    }
}

public class Jippil {
    public int getDraso() {
        ...
    }

    public Osmcest getAdea() {
        ...
    }
}

public class Marwir extends Prac {
    public Castass getLorf() {
        ...
    }
}

public class Masm extends Ucru {
    public File getPomoc() {
        ...
    }
}

public class Mebre {
    public File getBic() {
        ...
    }

    public List<Tood> getCeses() {
        ...
    }
}

public class Olcar {
    public List<String> getCaTren() {
        ...
    }
}

public class Olsti {
    public List<Vumes> getEcses() {
        ...
    }

    public List<EniThrer> getMiuis() {
        ...
    }

    public List<Masm> getRuiases() {
        ...
    }
}

public class Osmcest extends Trawhor {
    public String getHaDrir() {
        ...
    }
}

public class Oucau {
    public String getSleqo() {
        ...
    }
}

public class Pene extends Clanmi {
    public Olcar getPreou() {
        ...
    }
}

public class Piondged {
    public int getNiEm() {
        ...
    }
}

public class Platus {
    public int getCel() {
        ...
    }
}

public class Prac extends Piondged {
    public Callaet getAlCi() {
        ...
    }
}

public class Stri {
    public Platus getOcSux() {
        ...
    }

    public File getDiu() {
        ...
    }

    public String getAmBu() {
        ...
    }
}

public class Tood {
    public File getJaDe() {
        ...
    }
}

public class Trawhor {
    public List<Pene> getGlirs() {
        ...
    }

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

public class Ucru {
    public List<Jippil> getIlBas() {
        ...
    }

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

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

    Eendud pe

    ...and the following method:

    public void process(String item)

    ...write code to process the amBu of the first glir of each ilBa of the first ruias of the first idi of pe.

    Solution

    for (Brur idi : pe.getIdisList()) {
        for (Masm ruias : idi.getMarwir().getLorf().getIrDi().getRuiasesList()) {
            for (Pene glir : ruias.getUcru().getIlBas().get(0).getAdea().getTrawhor().getGlirsList()) {
                process(glir.getClanmi().getMiEr().getAmBu());
            }
        }
    }

Related puzzles: