Class relationships: Correct Solution


Consider the follow class declarations:

public class Algrec {
    public byte[] getWiHodme() {
        ...
    }
}

public class Erdqa {
    public String getAsuc() {
        ...
    }
}

public class Henem {
    public Tesm getVoHa() {
        ...
    }

    public Trintcil getVui() {
        ...
    }
}

public class Hingfi {
    public IcaAstex getSiLensa() {
        ...
    }

    public File getSlin() {
        ...
    }
}

public class IaiFlepal extends Nerdi {
    public String getPri() {
        ...
    }
}

public class IcaAstex extends Tiosmtra {
    public int getCiona() {
        ...
    }
}

public class Mesrooc extends Rimill {
    public byte[] getVing() {
        ...
    }
}

public class Nerdi {
    public byte[] getNel() {
        ...
    }

    public List<Henem> getIcecs() {
        ...
    }
}

public class OisPel {
    public String getPinpe() {
        ...
    }
}

public class Oudel {
    public int getPaHi() {
        ...
    }
}

public class Ploac {
    public byte[] getPou() {
        ...
    }
}

public class QirCispor extends Hingfi {
    public List<Mesrooc> getEors() {
        ...
    }

    public List<Ploac> getDilces() {
        ...
    }

    public OisPel getPhed() {
        ...
    }
}

public class RarSpac {
    public Shoddugh getGaRossa() {
        ...
    }

    public Erdqa getTidin() {
        ...
    }
}

public class Rimill {
    public String getKoPo() {
        ...
    }
}

public class Shoddugh extends Algrec {
    public List<QirCispor> getEthus() {
        ...
    }
}

public class Tesm {
    public File getMiest() {
        ...
    }

    public List<Oudel> getSlaans() {
        ...
    }

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

public class Tiosmtra {
    public int getIss() {
        ...
    }

    public List<IaiFlepal> getCassos() {
        ...
    }
}

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

    RarSpac u

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the prel of the first icec of the first casso of the first ethu of u.

    Solution

    for (QirCispor ethu : u.getGaRossa().getEthusList()) {
        for (IaiFlepal casso : ethu.getHingfi().getSiLensa().getTiosmtra().getCassosList()) {
            for (Henem icec : casso.getNerdi().getIcecsList()) {
                process(icec.getVoHa().getPrel());
            }
        }
    }

Related puzzles: