Class relationships: Correct Solution


Consider the follow class declarations:

public class Bantlang {
    public List<IpeTrie> getMoIses() {
        ...
    }

    public File getTresm() {
        ...
    }
}

public class Cilan {
    public Bantlang getNood() {
        ...
    }

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

public class Coas extends Rotriss {
    public byte[] getTioc() {
        ...
    }
}

public class Drera {
    public byte[] getGoum() {
        ...
    }
}

public class Feur {
    public List<Drera> getSphos() {
        ...
    }

    public File getIdInbil() {
        ...
    }
}

public class Hanpie extends Olmac {
    public String getDiost() {
        ...
    }
}

public class Inan extends Selsa {
    public List<Cilan> getPoMes() {
        ...
    }
}

public class Ingta extends Inan {
    public Paupim getCiend() {
        ...
    }
}

public class IpeTrie {
    public List<Hanpie> getPiHis() {
        ...
    }

    public Coas getCec() {
        ...
    }
}

public class Noapis {
    public byte[] getTesh() {
        ...
    }

    public List<Feur> getGicecs() {
        ...
    }

    public File getSeIara() {
        ...
    }
}

public class Olmac {
    public byte[] getTeSo() {
        ...
    }
}

public class Oocin {
    public byte[] getPraid() {
        ...
    }

    public Noapis getPulo() {
        ...
    }
}

public class Paupim {
    public Whas getNeEr() {
        ...
    }

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

public class Rotriss extends Oocin {
    public int getPreng() {
        ...
    }
}

public class Selsa {
    public File getPesm() {
        ...
    }
}

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

    Ingta ox

    ...and the following method:

    public void process(File item)

    ...write code to process the seIara of the first moIs of the first poMe of ox.

    Solution

    for (Cilan poMe : ox.getInan().getPoMesList()) {
        for (IpeTrie moIs : poMe.getNood().getMoIsesList()) {
            process(moIs.getCec().getRotriss().getOocin().getPulo().getSeIara());
        }
    }

Related puzzles: