Class relationships: Correct Solution


Consider the follow class declarations:

public class Cedscrang {
    public int getCeo() {
        ...
    }

    public List<Stormid> getIdses() {
        ...
    }
}

public class Cesm {
    public String getHeMiot() {
        ...
    }
}

public class CusJecri {
    public int getAaCi() {
        ...
    }
}

public class Dibpria {
    public File getPeIm() {
        ...
    }
}

public class Grarwil {
    public Schuza getFau() {
        ...
    }

    public Qangroong getTeso() {
        ...
    }
}

public class Greutsus {
    public int getEnDren() {
        ...
    }
}

public class Groc {
    public String getPril() {
        ...
    }
}

public class Hosma extends Cedscrang {
    public String getStin() {
        ...
    }
}

public class Iorblec {
    public List<Groc> getCanis() {
        ...
    }

    public Sasvel getPhont() {
        ...
    }

    public Irnpang getPhud() {
        ...
    }
}

public class Irnpang {
    public int getPrer() {
        ...
    }
}

public class Loshmu extends Pairstu {
    public Hosma getHax() {
        ...
    }
}

public class Masesh {
    public File getLeGral() {
        ...
    }

    public File getHass() {
        ...
    }
}

public class Moubis extends Loshmu {
    public List<Cesm> getRansos() {
        ...
    }
}

public class Pairstu extends Phrerd {
    public int getUuBalin() {
        ...
    }
}

public class Phrerd {
    public byte[] getEnhud() {
        ...
    }
}

public class Qangroong extends CusJecri {
    public List<Moubis> getRusces() {
        ...
    }
}

public class Roni {
    public List<String> getEsqec() {
        ...
    }
}

public class Sasvel extends Greutsus {
    public Truthior getStrer() {
        ...
    }
}

public class Schuza {
    public List<String> getSii() {
        ...
    }

    public List<Roni> getSuars() {
        ...
    }
}

public class Stormid extends Vaenla {
    public byte[] getHosno() {
        ...
    }
}

public class Truthior {
    public List<Masesh> getProols() {
        ...
    }

    public Dibpria getBeMo() {
        ...
    }
}

public class Vaenla {
    public List<Iorblec> getDiPhes() {
        ...
    }

    public List<String> getAtSoin() {
        ...
    }
}
  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:

    Grarwil in

    ...and the following method:

    public void process(File item)

    ...write code to process the hass of the first prool of the first diPhe of each idse of the first rusce of in.

    Solution

    for (Moubis rusce : in.getTeso().getRuscesList()) {
        for (Iorblec diPhe : rusce.getLoshmu().getHax().getCedscrang().getIdses().get(0).getVaenla().getDiPhesList()) {
            for (Masesh prool : diPhe.getPhont().getStrer().getProolsList()) {
                process(prool.getHass());
            }
        }
    }

Related puzzles: