Class relationships: Correct Solution


Consider the follow class declarations:

public class Cezu {
    public List<String> getCic() {
        ...
    }

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

public class Enac {
    public Panpha getOuss() {
        ...
    }

    public int getUiConda() {
        ...
    }
}

public class Friphta {
    public int getNoScoli() {
        ...
    }
}

public class Jechbi {
    public String getGeMolit() {
        ...
    }
}

public class Liscua {
    public int getRilmo() {
        ...
    }

    public List<Jechbi> getApgis() {
        ...
    }
}

public class Panpha extends Friphta {
    public Spre getMaRaple() {
        ...
    }

    public Seicla getAgci() {
        ...
    }
}

public class Seicla extends Liscua {
    public List<Cezu> getFoCis() {
        ...
    }
}

public class Serect extends Enac {
    public File getEeIs() {
        ...
    }
}

public class Snesfran {
    public int getNeOr() {
        ...
    }

    public List<Serect> getOcPhashs() {
        ...
    }
}

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

    Snesfran so

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the koc of the first foCi of the first ocPhash of so.

    Solution

    for (Serect ocPhash : so.getOcPhashsList()) {
        for (Cezu foCi : ocPhash.getEnac().getOuss().getAgci().getFoCisList()) {
            process(foCi.getKoc());
        }
    }

Related puzzles: