Class relationships: Correct Solution


Consider the follow class declarations:

public class Aurrin {
    public byte[] getSana() {
        ...
    }
}

public class Breshtiog {
    public Aurrin getPosa() {
        ...
    }

    public List<Porphli> getClus() {
        ...
    }
}

public class Cermens {
    public List<Cesper> getXics() {
        ...
    }

    public List<Sinn> getZisses() {
        ...
    }
}

public class Cesper {
    public String getViLa() {
        ...
    }
}

public class Gocin {
    public Breshtiog getIduo() {
        ...
    }

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

    public File getEnt() {
        ...
    }
}

public class Gordcor {
    public List<String> getOod() {
        ...
    }

    public List<Gocin> getNouens() {
        ...
    }
}

public class Ostes extends Shal {
    public Gordcor getSas() {
        ...
    }
}

public class Porphli {
    public int getMous() {
        ...
    }
}

public class Seti extends Cermens {
    public byte[] getSme() {
        ...
    }
}

public class Shal {
    public String getOoc() {
        ...
    }
}

public class Sinn extends Ostes {
    public byte[] getTiDa() {
        ...
    }
}

public class Strian {
    public Seti getEtto() {
        ...
    }

    public int getAstos() {
        ...
    }
}
  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:

    Strian ir

    ...and the following method:

    public void process(File item)

    ...write code to process the ent of the first nouen of each ziss of ir.

    Solution

    for (Gocin nouen : ir.getEtto().getCermens().getZisses().get(0).getOstes().getSas().getNouensList()) {
        process(nouen.getEnt());
    }

Related puzzles: