Class relationships: Correct Solution


Consider the follow class declarations:

public class Bieam {
    public Phol getCari() {
        ...
    }

    public File getThas() {
        ...
    }
}

public class Chism extends ZocScal {
    public Ista getSasdi() {
        ...
    }
}

public class EckPemit {
    public int getEnt() {
        ...
    }

    public List<Rosmspol> getOnises() {
        ...
    }
}

public class Fepsben extends Soin {
    public List<Rasfar> getSeBisgos() {
        ...
    }

    public Wiurret getCeOrne() {
        ...
    }
}

public class Infa extends Bieam {
    public byte[] getGeAndou() {
        ...
    }
}

public class Ista {
    public String getOlFamu() {
        ...
    }
}

public class Kniss {
    public String getDeng() {
        ...
    }
}

public class Phol {
    public List<Chism> getAcnis() {
        ...
    }

    public List<EckPemit> getOnmocs() {
        ...
    }
}

public class Rasfar {
    public byte[] getBirer() {
        ...
    }

    public Vingep getHinso() {
        ...
    }
}

public class Rosmspol {
    public byte[] getLafia() {
        ...
    }
}

public class Soin {
    public Kniss getPra() {
        ...
    }

    public String getStiud() {
        ...
    }
}

public class Vingep extends Infa {
    public List<String> getNosal() {
        ...
    }
}

public class Wiurret {
    public File getOuGaar() {
        ...
    }
}

public class ZocScal {
    public String getVaIk() {
        ...
    }

    public List<String> getElSecci() {
        ...
    }
}
  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:

    Fepsben cou

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the elSecci of the first acni of the first seBisgo of cou.

    Solution

    for (Rasfar seBisgo : cou.getSeBisgosList()) {
        for (Chism acni : seBisgo.getHinso().getInfa().getBieam().getCari().getAcnisList()) {
            process(acni.getZocScal().getElSecci());
        }
    }

Related puzzles: