Class relationships: Correct Solution


Consider the follow class declarations:

public class Bont extends Medprua {
    public int getPel() {
        ...
    }
}

public class DedIsppris {
    public List<Scule> getEdSunds() {
        ...
    }

    public List<Bont> getOpPos() {
        ...
    }

    public Orta getMiin() {
        ...
    }
}

public class Esel {
    public List<String> getBlipi() {
        ...
    }
}

public class Medprua {
    public int getIom() {
        ...
    }

    public Pruo getRemu() {
        ...
    }
}

public class Orta {
    public String getEcCesul() {
        ...
    }
}

public class Pouclu extends Tranhai {
    public List<Pundpang> getPlaels() {
        ...
    }
}

public class Pruo {
    public File getVengu() {
        ...
    }

    public List<Pouclu> getProtas() {
        ...
    }
}

public class Pundpang extends Soank {
    public int getHali() {
        ...
    }
}

public class Scule {
    public int getChel() {
        ...
    }
}

public class Skass {
    public List<String> getAntem() {
        ...
    }

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

public class Soank {
    public File getMoCus() {
        ...
    }
}

public class Tranhai {
    public Skass getLeia() {
        ...
    }

    public Esel getIoSo() {
        ...
    }
}
  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:

    DedIsppris tism

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the nosm of the first prota of each opPo of tism.

    Solution

    for (Pouclu prota : tism.getOpPos().get(0).getMedprua().getRemu().getProtasList()) {
        process(prota.getTranhai().getLeia().getNosm());
    }

Related puzzles: