Class relationships: Correct Solution


Consider the follow class declarations:

public class Cashthon extends Chihac {
    public List<Henod> getCriors() {
        ...
    }
}

public class Chihac {
    public List<String> getCrul() {
        ...
    }
}

public class Eploud {
    public File getOnCick() {
        ...
    }
}

public class Eshwurm {
    public int getVoLu() {
        ...
    }
}

public class Felcrax extends Vedhior {
    public List<String> getSle() {
        ...
    }
}

public class Feni {
    public Rotwoa getWiUndua() {
        ...
    }

    public List<Sierd> getUpfos() {
        ...
    }
}

public class Flau {
    public byte[] getMemri() {
        ...
    }
}

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

    public int getOcec() {
        ...
    }
}

public class Hass extends Feni {
    public byte[] getSesic() {
        ...
    }
}

public class Henod {
    public File getCunil() {
        ...
    }

    public Thassud getSme() {
        ...
    }
}

public class Iaphmuss extends Pisad {
    public Spren getIpsem() {
        ...
    }

    public Sipt getHeNuss() {
        ...
    }
}

public class Idset extends Felcrax {
    public List<Groc> getPsels() {
        ...
    }
}

public class Pisad {
    public String getWern() {
        ...
    }
}

public class PleWonoc {
    public String getLoMeoc() {
        ...
    }
}

public class Rotwoa {
    public List<Eshwurm> getOicses() {
        ...
    }

    public List<Cashthon> getSiphis() {
        ...
    }
}

public class Sierd {
    public byte[] getVap() {
        ...
    }
}

public class Sipt {
    public int getSes() {
        ...
    }
}

public class Spren extends Thonspef {
    public Flau getAcGuou() {
        ...
    }
}

public class Thassud extends Thosul {
    public PleWonoc getAdOw() {
        ...
    }
}

public class Thonspef {
    public Idset getHael() {
        ...
    }

    public int getOoEpe() {
        ...
    }
}

public class Thosul {
    public List<Iaphmuss> getScris() {
        ...
    }

    public List<Eploud> getIrNosses() {
        ...
    }
}

public class Vedhior {
    public byte[] getEal() {
        ...
    }
}
  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:

    Hass pel

    ...and the following method:

    public void process(int item)

    ...write code to process the ocec of the first psel of each scri of each crior of the first siphi of pel.

    Solution

    for (Cashthon siphi : pel.getFeni().getWiUndua().getSiphisList()) {
        for (Groc psel : siphi.getCriors().get(0).getSme().getThosul().getScris().get(0).getIpsem().getThonspef().getHael().getPselsList()) {
            process(psel.getOcec());
        }
    }

Related puzzles: