Class relationships: Correct Solution


Consider the follow class declarations:

public class Cocla {
    public Plar getCed() {
        ...
    }

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

public class Cosbi {
    public int getIair() {
        ...
    }
}

public class Crosh {
    public int getUth() {
        ...
    }

    public List<Shistti> getGrunds() {
        ...
    }

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

public class DusIssbrac {
    public Eccan getStes() {
        ...
    }

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

public class Eccan extends Crosh {
    public byte[] getPesaw() {
        ...
    }
}

public class Enspled {
    public String getCoka() {
        ...
    }
}

public class Jufik extends Presshon {
    public Ladbe getPhlo() {
        ...
    }
}

public class Ladbe {
    public String getCio() {
        ...
    }
}

public class Lamre {
    public Phinprack getSti() {
        ...
    }

    public List<Phianpro> getEuls() {
        ...
    }
}

public class Lerin extends Luntca {
    public List<Noco> getOdVantis() {
        ...
    }

    public List<Osmfe> getAePhas() {
        ...
    }
}

public class Luntca {
    public List<String> getWern() {
        ...
    }

    public List<Cocla> getPeshs() {
        ...
    }
}

public class Malpec extends Cosbi {
    public Patdi getTus() {
        ...
    }
}

public class NalMudil extends Enspled {
    public List<DusIssbrac> getBlars() {
        ...
    }
}

public class Noco {
    public String getIdNeai() {
        ...
    }
}

public class Numec {
    public Lamre getPeock() {
        ...
    }

    public int getFosve() {
        ...
    }
}

public class Osmfe {
    public File getHoPe() {
        ...
    }
}

public class Patdi {
    public int getNildu() {
        ...
    }

    public List<Lerin> getAsZeasses() {
        ...
    }
}

public class Phianpro extends NalMudil {
    public File getCasm() {
        ...
    }
}

public class Phinprack {
    public List<String> getPhe() {
        ...
    }

    public List<UisHea> getCiIndens() {
        ...
    }
}

public class Plar extends Numec {
    public int getNup() {
        ...
    }
}

public class Presshon {
    public int getSiul() {
        ...
    }
}

public class Renoed {
    public List<String> getWinhe() {
        ...
    }
}

public class Shistti extends Jufik {
    public Renoed getEde() {
        ...
    }
}

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

    Malpec ec

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the beWaci of each blar of each eul of the first pesh of each asZeass of ec.

    Solution

    for (Cocla pesh : ec.getTus().getAsZeasses().get(0).getLuntca().getPeshsList()) {
        process(pesh.getCed().getNumec().getPeock().getEuls().get(0).getNalMudil().getBlars().get(0).getStes().getCrosh().getBeWaci());
    }

Related puzzles: