Class relationships: Correct Solution


Consider the follow class declarations:

public class Alpra {
    public List<String> getCiMo() {
        ...
    }
}

public class Asgior {
    public Hiece getSpuou() {
        ...
    }

    public File getImo() {
        ...
    }
}

public class Bralse {
    public Dael getSios() {
        ...
    }

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

public class Cesto extends Proic {
    public String getAng() {
        ...
    }
}

public class Cidme {
    public byte[] getEaCian() {
        ...
    }
}

public class Dael extends OfaBrusbos {
    public List<String> getImwhi() {
        ...
    }
}

public class DicStearldi {
    public List<Asgior> getEpMirors() {
        ...
    }

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

public class Hedci {
    public byte[] getDrus() {
        ...
    }
}

public class Hiece {
    public int getCrid() {
        ...
    }

    public Plont getBeDunu() {
        ...
    }
}

public class Meuc {
    public List<Nilar> getBapacs() {
        ...
    }

    public int getPoli() {
        ...
    }
}

public class Mied extends Alpra {
    public List<Cesto> getEtrels() {
        ...
    }
}

public class Mispran {
    public byte[] getNedei() {
        ...
    }

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

public class Mudpsir extends Cidme {
    public Snonth getDest() {
        ...
    }

    public Stac getUple() {
        ...
    }

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

public class Nilar {
    public File getPoru() {
        ...
    }
}

public class Nosmwe {
    public int getGiHaesm() {
        ...
    }

    public Hedci getCawia() {
        ...
    }
}

public class OfaBrusbos {
    public Meuc getPaVilto() {
        ...
    }

    public List<Mudpsir> getMenmas() {
        ...
    }
}

public class Plont extends Mied {
    public List<String> getBaIdi() {
        ...
    }
}

public class Predpre extends DicStearldi {
    public File getTroc() {
        ...
    }
}

public class Proic extends Mispran {
    public List<Bralse> getRallis() {
        ...
    }

    public List<Nosmwe> getArCucs() {
        ...
    }
}

public class Rasstrit {
    public byte[] getBia() {
        ...
    }
}

public class Snonth {
    public int getWoess() {
        ...
    }
}

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

    Predpre ebio

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the edew of the first menma of each ralli of each etrel of each epMiror of ebio.

    Solution

    for (Mudpsir menma : ebio.getDicStearldi().getEpMirors().get(0).getSpuou().getBeDunu().getMied().getEtrels().get(0).getProic().getRallis().get(0).getSios().getOfaBrusbos().getMenmasList()) {
        process(menma.getEdew());
    }

Related puzzles: