Class relationships: Correct Solution


Consider the follow class declarations:

public class Aerm {
    public Encim getAssco() {
        ...
    }

    public String getSwen() {
        ...
    }
}

public class Encim {
    public List<EroHetoss> getSaBidecs() {
        ...
    }

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

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

public class EroHetoss {
    public List<Spitin> getReDeds() {
        ...
    }

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

public class Giorftiarp {
    public int getFuViasa() {
        ...
    }

    public Aerm getRiSuxa() {
        ...
    }
}

public class MepQioghte {
    public List<Giorftiarp> getIrChelds() {
        ...
    }

    public File getPrual() {
        ...
    }
}

public class Papan extends MepQioghte {
    public Piarmwa getThori() {
        ...
    }
}

public class Piarmwa {
    public byte[] getArTi() {
        ...
    }
}

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

    Papan nin

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the osu of the first irCheld of nin.

    Solution

    for (Giorftiarp irCheld : nin.getMepQioghte().getIrCheldsList()) {
        process(irCheld.getRiSuxa().getAssco().getOsu());
    }

Related puzzles: