Class relationships: Correct Solution


Consider the follow class declarations:

public class Cintsten {
    public byte[] getMoh() {
        ...
    }
}

public class Dombec {
    public String getHiLelim() {
        ...
    }
}

public class Dorchao extends Sangpa {
    public byte[] getMecoc() {
        ...
    }
}

public class Esmdi {
    public int getIact() {
        ...
    }
}

public class Fentce {
    public Dorchao getGrer() {
        ...
    }

    public int getJeber() {
        ...
    }
}

public class Flimea {
    public int getBiil() {
        ...
    }

    public List<Fentce> getBaunes() {
        ...
    }
}

public class Ipou {
    public int getEis() {
        ...
    }

    public Cintsten getCecoo() {
        ...
    }

    public int getCePid() {
        ...
    }
}

public class Sangpa extends Stoft {
    public Tengop getOsElre() {
        ...
    }
}

public class Stoft {
    public List<Ipou> getRaIas() {
        ...
    }

    public byte[] getIlrad() {
        ...
    }
}

public class Tengop extends Esmdi {
    public List<Dombec> getFrunis() {
        ...
    }
}
  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:

    Flimea cios

    ...and the following method:

    public void process(int item)

    ...write code to process the cePid of the first raIa of each baune of cios.

    Solution

    for (Ipou raIa : cios.getBaunes().get(0).getGrer().getSangpa().getStoft().getRaIasList()) {
        process(raIa.getCePid());
    }

Related puzzles: