Class relationships: Correct Solution


Consider the follow class declarations:

public class Cadmac extends Focmo {
    public List<Mirdmos> getEaMetucs() {
        ...
    }
}

public class Cung {
    public int getFiIr() {
        ...
    }

    public List<PheManerm> getIapas() {
        ...
    }
}

public class Focmo {
    public Qesnan getTric() {
        ...
    }

    public PneSisnen getMamu() {
        ...
    }

    public List<Jact> getLiEeses() {
        ...
    }
}

public class Jact {
    public byte[] getAdHesm() {
        ...
    }

    public NirMeaur getSmuc() {
        ...
    }
}

public class Mirdmos {
    public int getIoRi() {
        ...
    }
}

public class Niang {
    public File getXan() {
        ...
    }
}

public class NirMeaur {
    public Cung getThap() {
        ...
    }

    public String getZoing() {
        ...
    }
}

public class PheManerm extends Niang {
    public File getNauac() {
        ...
    }

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

public class PneSisnen {
    public String getAnIant() {
        ...
    }
}

public class Qesnan {
    public File getGuth() {
        ...
    }
}
  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:

    Cadmac ird

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the hamum of each iapa of the first liEes of ird.

    Solution

    for (Jact liEes : ird.getFocmo().getLiEesesList()) {
        process(liEes.getSmuc().getThap().getIapas().get(0).getHamum());
    }

Related puzzles: