Class relationships: Correct Solution


Consider the follow class declarations:

public class Aucces {
    public int getCaia() {
        ...
    }
}

public class Bued {
    public List<Rerm> getOnous() {
        ...
    }

    public File getEtost() {
        ...
    }
}

public class Cermbec {
    public List<Prasssous> getSpers() {
        ...
    }

    public List<Peshil> getLeots() {
        ...
    }
}

public class Hichism {
    public int getNiss() {
        ...
    }
}

public class Ipred {
    public File getDesm() {
        ...
    }
}

public class IsaDeid {
    public List<Moclec> getThrons() {
        ...
    }

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

public class Moclec {
    public RalSqa getTroa() {
        ...
    }

    public List<Aucces> getIrens() {
        ...
    }
}

public class NalDoadsho {
    public String getKuStri() {
        ...
    }
}

public class NudOnga {
    public Trodud getRecac() {
        ...
    }

    public List<Ucen> getIaIrahs() {
        ...
    }
}

public class PelHouspharl {
    public List<String> getWec() {
        ...
    }

    public List<Praingtu> getGalacs() {
        ...
    }
}

public class Peshil {
    public Teber getOwre() {
        ...
    }

    public List<Pucprol> getOrLoses() {
        ...
    }
}

public class Praingtu extends Prestan {
    public Teniss getHesm() {
        ...
    }
}

public class Prasssous extends NalDoadsho {
    public byte[] getBeGraen() {
        ...
    }
}

public class Prestan extends Ipred {
    public Bued getCeOis() {
        ...
    }
}

public class Pucprol {
    public List<String> getHaPeu() {
        ...
    }
}

public class RalSqa extends PelHouspharl {
    public List<String> getUabo() {
        ...
    }
}

public class Rerm extends Sted {
    public byte[] getThias() {
        ...
    }
}

public class Spalpsen extends Cermbec {
    public Tullac getUdMirsa() {
        ...
    }
}

public class Sted extends Hichism {
    public Spalpsen getPhund() {
        ...
    }
}

public class Teber {
    public NudOnga getMaPafla() {
        ...
    }

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

    public File getPseas() {
        ...
    }
}

public class Teniss {
    public int getLifre() {
        ...
    }
}

public class Trodud {
    public int getOiff() {
        ...
    }
}

public class Tullac {
    public byte[] getWiCorar() {
        ...
    }
}

public class Ucen {
    public int getUtEn() {
        ...
    }
}
  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:

    IsaDeid heci

    ...and the following method:

    public void process(File item)

    ...write code to process the pseas of each leot of the first onou of each galac of the first thron of heci.

    Solution

    for (Moclec thron : heci.getThronsList()) {
        for (Rerm onou : thron.getTroa().getPelHouspharl().getGalacs().get(0).getPrestan().getCeOis().getOnousList()) {
            process(onou.getSted().getPhund().getCermbec().getLeots().get(0).getOwre().getPseas());
        }
    }

Related puzzles: