Class relationships: Correct Solution


Consider the follow class declarations:

public class Alnias {
    public String getEmSmoel() {
        ...
    }
}

public class CesGruen extends Gnarhiog {
    public ScoMenfil getTril() {
        ...
    }
}

public class Cossthett extends SioBlik {
    public int getNioa() {
        ...
    }

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

public class Engfle {
    public List<Grai> getEdprus() {
        ...
    }

    public List<Rauja> getAlIrds() {
        ...
    }
}

public class Eolna {
    public byte[] getReXeved() {
        ...
    }
}

public class Fluees {
    public byte[] getCasso() {
        ...
    }

    public List<Schecu> getPeJos() {
        ...
    }
}

public class Gnarhiog {
    public List<String> getRaOn() {
        ...
    }
}

public class Grai {
    public File getItEpros() {
        ...
    }

    public Cossthett getOrce() {
        ...
    }
}

public class Kiadsoc {
    public String getOeVep() {
        ...
    }
}

public class Leaphe {
    public Alnias getEit() {
        ...
    }

    public List<UntSnol> getSwours() {
        ...
    }
}

public class Pocpol extends CesGruen {
    public List<String> getCiIord() {
        ...
    }
}

public class Pric extends Sispic {
    public Pocpol getPaHosec() {
        ...
    }
}

public class Psosi {
    public SmeFoas getTrico() {
        ...
    }

    public File getJor() {
        ...
    }
}

public class Rauja {
    public File getNimad() {
        ...
    }

    public Eolna getOnjam() {
        ...
    }
}

public class Schecu extends Pric {
    public List<Truftme> getOngs() {
        ...
    }
}

public class ScoMenfil extends Kiadsoc {
    public List<Engfle> getLiatus() {
        ...
    }
}

public class SioBlik {
    public List<String> getTiNir() {
        ...
    }
}

public class Sispic {
    public int getOvat() {
        ...
    }

    public Leaphe getGaScis() {
        ...
    }
}

public class SmeFoas {
    public String getRil() {
        ...
    }

    public List<Stasbi> getGoDruis() {
        ...
    }
}

public class Stasbi extends Fluees {
    public File getIchi() {
        ...
    }
}

public class Truftme {
    public List<String> getNacgi() {
        ...
    }
}

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

    Psosi ued

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the sto of each edpru of each liatu of the first peJo of the first goDrui of ued.

    Solution

    for (Stasbi goDrui : ued.getTrico().getGoDruisList()) {
        for (Schecu peJo : goDrui.getFluees().getPeJosList()) {
            process(peJo.getPric().getPaHosec().getCesGruen().getTril().getLiatus().get(0).getEdprus().get(0).getOrce().getSto());
        }
    }

Related puzzles: