Class relationships: Correct Solution


Consider the follow class declarations:

public class Bocsiu extends Soupe {
    public int getPhred() {
        ...
    }
}

public class CocSoll {
    public Sallbe getOnrer() {
        ...
    }

    public HacOmick getMahad() {
        ...
    }
}

public class Colnonk {
    public List<Bocsiu> getBeshes() {
        ...
    }

    public List<EacSiia> getNoetis() {
        ...
    }
}

public class Dauiad {
    public byte[] getOeMaff() {
        ...
    }
}

public class EacSiia extends Siant {
    public byte[] getRer() {
        ...
    }
}

public class Emhe {
    public int getLoQeso() {
        ...
    }
}

public class Fidtor extends Preish {
    public Emhe getIes() {
        ...
    }

    public Colnonk getMiAc() {
        ...
    }
}

public class Groodin {
    public Pontvid getCaivo() {
        ...
    }

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

public class Gunde {
    public File getNeRe() {
        ...
    }
}

public class HacOmick extends Fidtor {
    public String getPeEsa() {
        ...
    }
}

public class Mofass {
    public File getTroc() {
        ...
    }
}

public class Poir {
    public String getOnSaass() {
        ...
    }

    public List<CocSoll> getBuBris() {
        ...
    }
}

public class Pontvid {
    public byte[] getHiol() {
        ...
    }

    public List<Poir> getIegos() {
        ...
    }
}

public class Preish {
    public File getShasm() {
        ...
    }
}

public class Sallbe {
    public File getSeWhu() {
        ...
    }
}

public class Siant extends Mofass {
    public List<String> getAnGe() {
        ...
    }

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

public class Soupe {
    public List<Gunde> getHerases() {
        ...
    }

    public File getDaden() {
        ...
    }
}

public class Tasqasm extends Groodin {
    public List<Dauiad> getOlHonuns() {
        ...
    }
}
  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:

    Tasqasm li

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the teIr of the first noeti of the first buBri of the first iego of li.

    Solution

    for (Poir iego : li.getGroodin().getCaivo().getIegosList()) {
        for (CocSoll buBri : iego.getBuBrisList()) {
            for (EacSiia noeti : buBri.getMahad().getFidtor().getMiAc().getNoetisList()) {
                process(noeti.getSiant().getTeIr());
            }
        }
    }

Related puzzles: