Class relationships: Correct Solution


Consider the follow class declarations:

public class Docod {
    public List<Mistre> getNacos() {
        ...
    }

    public List<Neflau> getNiOcmos() {
        ...
    }

    public List<Gerniound> getDongos() {
        ...
    }
}

public class Dontknert {
    public Sosvess getQon() {
        ...
    }

    public Tirmu getEsh() {
        ...
    }

    public List<Phof> getPritos() {
        ...
    }
}

public class Gerniound {
    public byte[] getQeFespu() {
        ...
    }
}

public class Hispow extends Medto {
    public Photwang getTru() {
        ...
    }
}

public class Meac {
    public Siom getZiIdzo() {
        ...
    }

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

public class Medto {
    public Docod getPamas() {
        ...
    }

    public String getSiNel() {
        ...
    }
}

public class Mistre extends Olqun {
    public byte[] getGoHass() {
        ...
    }

    public File getIsTroip() {
        ...
    }
}

public class Neflau {
    public String getBri() {
        ...
    }
}

public class Olqun {
    public List<String> getToStul() {
        ...
    }
}

public class Phof {
    public List<Hispow> getFemos() {
        ...
    }

    public File getWaEpia() {
        ...
    }
}

public class Photwang {
    public String getRer() {
        ...
    }
}

public class Siom extends Dontknert {
    public int getMocid() {
        ...
    }
}

public class Sosvess {
    public byte[] getTapi() {
        ...
    }
}

public class Tirmu {
    public int getCoIcerm() {
        ...
    }
}
  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:

    Meac esio

    ...and the following method:

    public void process(File item)

    ...write code to process the isTroip of the first naco of each femo of each prito of esio.

    Solution

    for (Mistre naco : esio.getZiIdzo().getDontknert().getPritos().get(0).getFemos().get(0).getMedto().getPamas().getNacosList()) {
        process(naco.getIsTroip());
    }

Related puzzles: