Class relationships: Correct Solution


Consider the follow class declarations:

public class AngIdlet extends Iafos {
    public Igprild getSkia() {
        ...
    }
}

public class Asser {
    public File getDipre() {
        ...
    }
}

public class Burmcleng {
    public int getDuis() {
        ...
    }
}

public class Choment extends Mosm {
    public Peuel getBeDiend() {
        ...
    }
}

public class Iafos {
    public File getAmont() {
        ...
    }
}

public class Igprild {
    public List<String> getTre() {
        ...
    }

    public List<Choment> getQoeles() {
        ...
    }
}

public class Iorn extends Merpi {
    public Asser getEslir() {
        ...
    }
}

public class Jilspad extends Skemsi {
    public byte[] getCohe() {
        ...
    }
}

public class Lism {
    public byte[] getPlere() {
        ...
    }
}

public class Merpi {
    public File getAbi() {
        ...
    }
}

public class Mosm {
    public Lism getEdme() {
        ...
    }

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

    public String getGiAe() {
        ...
    }
}

public class Oecposh extends Singbreck {
    public List<Burmcleng> getBoungs() {
        ...
    }
}

public class Peuel {
    public byte[] getCoXing() {
        ...
    }
}

public class Singbreck {
    public List<Ubia> getWenpas() {
        ...
    }

    public List<Iorn> getFosas() {
        ...
    }
}

public class Skemsi {
    public List<AngIdlet> getPracs() {
        ...
    }

    public int getPid() {
        ...
    }
}

public class Ubia {
    public List<String> getMecad() {
        ...
    }

    public Jilspad getSto() {
        ...
    }
}
  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:

    Oecposh gle

    ...and the following method:

    public void process(String item)

    ...write code to process the giAe of the first qoele of the first prac of the first wenpa of gle.

    Solution

    for (Ubia wenpa : gle.getSingbreck().getWenpasList()) {
        for (AngIdlet prac : wenpa.getSto().getSkemsi().getPracsList()) {
            for (Choment qoele : prac.getSkia().getQoelesList()) {
                process(qoele.getMosm().getGiAe());
            }
        }
    }

Related puzzles: