Class relationships: Correct Solution


Consider the follow class declarations:

public class Alel {
    public List<String> getFese() {
        ...
    }
}

public class Asco {
    public List<Santwha> getPheas() {
        ...
    }

    public int getOap() {
        ...
    }
}

public class Cesosm {
    public String getTet() {
        ...
    }
}

public class Clir {
    public byte[] getEnhal() {
        ...
    }
}

public class Creal extends Clir {
    public List<Plues> getIcmis() {
        ...
    }
}

public class Duassmast extends Creal {
    public KecTupro getBrics() {
        ...
    }
}

public class Erwes {
    public String getSwod() {
        ...
    }
}

public class Fiecent extends Iblel {
    public Finbriss getEtCo() {
        ...
    }
}

public class Finbriss {
    public File getPreck() {
        ...
    }

    public int getFiPnid() {
        ...
    }
}

public class Hutchdois extends Sphec {
    public int getArdto() {
        ...
    }
}

public class Iblel {
    public byte[] getSatea() {
        ...
    }

    public Plaentu getSwil() {
        ...
    }
}

public class Icnee extends Trir {
    public List<Asco> getLiHious() {
        ...
    }
}

public class Iliun {
    public Whica getHados() {
        ...
    }

    public Erwes getAsMalu() {
        ...
    }
}

public class KecTupro {
    public File getGenta() {
        ...
    }
}

public class Osniss {
    public File getMieng() {
        ...
    }

    public Icnee getDeBecic() {
        ...
    }
}

public class Plaentu {
    public byte[] getPraku() {
        ...
    }
}

public class Plues extends Osniss {
    public List<Cesosm> getPuRerks() {
        ...
    }
}

public class Rascriol {
    public File getErBlus() {
        ...
    }
}

public class Santwha {
    public List<String> getSada() {
        ...
    }
}

public class Shentblart {
    public String getRhope() {
        ...
    }

    public List<Alel> getPadpes() {
        ...
    }
}

public class Sirpic {
    public byte[] getMomag() {
        ...
    }

    public Duassmast getOtMe() {
        ...
    }
}

public class Sphec {
    public int getIdTi() {
        ...
    }

    public List<Sirpic> getJises() {
        ...
    }
}

public class Trir {
    public List<Fiecent> getInstos() {
        ...
    }

    public Rascriol getPhac() {
        ...
    }
}

public class Whica extends Shentblart {
    public List<Hutchdois> getEdGoils() {
        ...
    }
}
  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:

    Iliun iosh

    ...and the following method:

    public void process(int item)

    ...write code to process the fiPnid of the first insto of each icmi of each jis of each edGoil of iosh.

    Solution

    for (Fiecent insto : iosh.getHados().getEdGoils().get(0).getSphec().getJises().get(0).getOtMe().getCreal().getIcmis().get(0).getOsniss().getDeBecic().getTrir().getInstosList()) {
        process(insto.getEtCo().getFiPnid());
    }

Related puzzles: