Class relationships: Correct Solution


Consider the follow class declarations:

public class Bross {
    public int getPra() {
        ...
    }
}

public class Clac {
    public Ishos getTicac() {
        ...
    }

    public List<Psel> getAesses() {
        ...
    }
}

public class Cloesh {
    public String getOuVist() {
        ...
    }
}

public class Curstrent {
    public String getBic() {
        ...
    }
}

public class Iogash {
    public List<String> getAsPi() {
        ...
    }

    public List<Plir> getBidwos() {
        ...
    }
}

public class Ishos {
    public String getRiChroo() {
        ...
    }

    public List<Bross> getSeerus() {
        ...
    }
}

public class Muper {
    public File getAnEsgi() {
        ...
    }

    public List<Pral> getHadbis() {
        ...
    }
}

public class Nafid extends Clac {
    public Cloesh getMosdu() {
        ...
    }
}

public class Ongs {
    public List<PleDeent> getGaPreles() {
        ...
    }

    public File getGrer() {
        ...
    }
}

public class PleDeent extends Tonxil {
    public List<Curstrent> getUmEks() {
        ...
    }

    public Plenen getIrDri() {
        ...
    }
}

public class Plenen extends Muper {
    public byte[] getShint() {
        ...
    }
}

public class Plir {
    public List<String> getPha() {
        ...
    }
}

public class Pral {
    public List<String> getNaded() {
        ...
    }

    public File getCirku() {
        ...
    }
}

public class Psel extends Shirou {
    public Stis getCubo() {
        ...
    }
}

public class Shirou {
    public int getSaes() {
        ...
    }
}

public class Stis extends Ongs {
    public List<String> getFeWhal() {
        ...
    }
}

public class Toexgi {
    public Nafid getGlorg() {
        ...
    }

    public int getDeRuvi() {
        ...
    }
}

public class Tonxil {
    public Iogash getOuc() {
        ...
    }

    public File getAcHess() {
        ...
    }
}
  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:

    Toexgi phia

    ...and the following method:

    public void process(File item)

    ...write code to process the cirku of each hadbi of the first gaPrele of each aess of phia.

    Solution

    for (PleDeent gaPrele : phia.getGlorg().getClac().getAesses().get(0).getCubo().getOngs().getGaPrelesList()) {
        process(gaPrele.getIrDri().getMuper().getHadbis().get(0).getCirku());
    }

Related puzzles: