Class relationships: Correct Solution


Consider the follow class declarations:

public class Amod {
    public int getSaWhu() {
        ...
    }
}

public class Anner extends Phutch {
    public byte[] getGahe() {
        ...
    }

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

public class Assan extends Sathe {
    public String getMoulm() {
        ...
    }
}

public class Cebis {
    public int getHaSathi() {
        ...
    }
}

public class Daneng {
    public EckErdo getFicon() {
        ...
    }

    public List<Amod> getRals() {
        ...
    }

    public Desur getIsta() {
        ...
    }
}

public class Desur {
    public String getCiMish() {
        ...
    }
}

public class Dirbun extends Osscoc {
    public File getGaPi() {
        ...
    }
}

public class Dissist extends Phume {
    public String getJont() {
        ...
    }
}

public class EckErdo {
    public List<String> getEdhi() {
        ...
    }

    public List<Olcos> getMios() {
        ...
    }
}

public class Flechi extends Anner {
    public File getCiod() {
        ...
    }
}

public class Knes {
    public String getAdRioss() {
        ...
    }
}

public class MurPrel {
    public File getGlou() {
        ...
    }
}

public class Neswi {
    public int getHesa() {
        ...
    }
}

public class Olcos extends Roais {
    public Dissist getBeeal() {
        ...
    }
}

public class OmpTre {
    public List<Assan> getCails() {
        ...
    }

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

public class Osscoc {
    public List<String> getJoJis() {
        ...
    }

    public MurPrel getNac() {
        ...
    }
}

public class Pharstal {
    public List<Flechi> getPids() {
        ...
    }

    public List<Neswi> getLoEds() {
        ...
    }
}

public class Phume {
    public byte[] getNiBla() {
        ...
    }

    public List<OmpTre> getImIuns() {
        ...
    }
}

public class Phutch {
    public byte[] getDenin() {
        ...
    }
}

public class Roais {
    public List<Cebis> getOnTarpas() {
        ...
    }

    public Knes getOrEm() {
        ...
    }
}

public class Sathe {
    public Pharstal getSund() {
        ...
    }

    public String getHiRa() {
        ...
    }
}

public class Tuimac extends Daneng {
    public Dirbun getNen() {
        ...
    }
}
  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:

    Tuimac alde

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the arel of the first pid of the first cail of the first imIun of each mio of alde.

    Solution

    for (OmpTre imIun : alde.getDaneng().getFicon().getMios().get(0).getBeeal().getPhume().getImIunsList()) {
        for (Assan cail : imIun.getCailsList()) {
            for (Flechi pid : cail.getSathe().getSund().getPidsList()) {
                process(pid.getAnner().getArel());
            }
        }
    }

Related puzzles: