Class relationships: Correct Solution


Consider the follow class declarations:

public class AmnOlda {
    public BirInclal getTrai() {
        ...
    }

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

public class AomIstfun {
    public List<String> getPog() {
        ...
    }
}

public class BirInclal {
    public File getNuGucha() {
        ...
    }
}

public class Ciccril {
    public String getDitho() {
        ...
    }
}

public class CusGuntsqi extends StoAec {
    public String getAxNio() {
        ...
    }
}

public class EctGlacell {
    public File getIlOcnia() {
        ...
    }

    public Geme getEdCendo() {
        ...
    }
}

public class Geme {
    public String getPispu() {
        ...
    }
}

public class Hirgid {
    public List<String> getAuAmer() {
        ...
    }

    public QotOclonch getKaca() {
        ...
    }
}

public class Mimiang {
    public byte[] getCiHa() {
        ...
    }

    public List<CusGuntsqi> getPlos() {
        ...
    }
}

public class Oingpeng extends Hirgid {
    public Ciccril getTriss() {
        ...
    }
}

public class QotOclonch extends Slefunt {
    public File getChism() {
        ...
    }
}

public class Sancea {
    public List<Wassspa> getEsms() {
        ...
    }

    public String getChiad() {
        ...
    }
}

public class Sleape extends AmnOlda {
    public int getAunim() {
        ...
    }
}

public class Slefunt {
    public List<Mimiang> getTruals() {
        ...
    }

    public File getRaer() {
        ...
    }
}

public class StoAec {
    public List<String> getIhe() {
        ...
    }

    public int getFlae() {
        ...
    }
}

public class Wassspa {
    public List<AomIstfun> getMepels() {
        ...
    }

    public Sleape getAng() {
        ...
    }

    public List<EctGlacell> getCesods() {
        ...
    }

    public Oingpeng getGec() {
        ...
    }
}
  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:

    Sancea gi

    ...and the following method:

    public void process(int item)

    ...write code to process the flae of the first plo of the first trual of the first esm of gi.

    Solution

    for (Wassspa esm : gi.getEsmsList()) {
        for (Mimiang trual : esm.getGec().getHirgid().getKaca().getSlefunt().getTrualsList()) {
            for (CusGuntsqi plo : trual.getPlosList()) {
                process(plo.getStoAec().getFlae());
            }
        }
    }

Related puzzles: