Class relationships: Correct Solution


Consider the follow class declarations:

public class Boute extends Thodal {
    public byte[] getIdMaa() {
        ...
    }
}

public class Dermirph extends Wecuc {
    public List<Boute> getOcars() {
        ...
    }
}

public class Descaus extends Reng {
    public List<Psara> getPaOdebs() {
        ...
    }
}

public class Dipamb {
    public byte[] getCerth() {
        ...
    }
}

public class Eodni {
    public List<Prea> getIocmes() {
        ...
    }

    public Kner getPiap() {
        ...
    }
}

public class Febep {
    public List<Descaus> getMeis() {
        ...
    }

    public String getLedo() {
        ...
    }
}

public class FelLisad extends PraHeght {
    public Dermirph getJich() {
        ...
    }

    public Siic getGroul() {
        ...
    }

    public Dipamb getLaErch() {
        ...
    }
}

public class Kner {
    public File getSoIr() {
        ...
    }
}

public class Krar {
    public int getAsEshba() {
        ...
    }

    public Eodni getCinsa() {
        ...
    }
}

public class Onsoor extends Tommod {
    public List<String> getPri() {
        ...
    }
}

public class PraHeght {
    public String getSuWien() {
        ...
    }
}

public class Prea extends FelLisad {
    public int getPahed() {
        ...
    }
}

public class Psara {
    public int getTiss() {
        ...
    }
}

public class Reng {
    public List<Onsoor> getPodkos() {
        ...
    }

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

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

public class Siic {
    public byte[] getNaon() {
        ...
    }
}

public class Thodal {
    public String getIsusm() {
        ...
    }

    public Febep getImon() {
        ...
    }
}

public class Tommod {
    public int getSarmo() {
        ...
    }
}

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

    Krar os

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the disca of each mei of the first ocar of each iocme of os.

    Solution

    for (Boute ocar : os.getCinsa().getIocmes().get(0).getFelLisad().getJich().getOcarsList()) {
        process(ocar.getThodal().getImon().getMeis().get(0).getReng().getDisca());
    }

Related puzzles: