Class relationships: Correct Solution


Consider the follow class declarations:

public class CocPif {
    public File getSead() {
        ...
    }

    public List<Ibrac> getPapos() {
        ...
    }
}

public class Diour extends Dirmfli {
    public List<Teec> getOeants() {
        ...
    }

    public List<Dosprec> getEnspas() {
        ...
    }
}

public class Dirmfli {
    public File getErmma() {
        ...
    }
}

public class Dosprec {
    public byte[] getIsden() {
        ...
    }
}

public class Dreoss {
    public File getAmDalor() {
        ...
    }
}

public class Eent {
    public List<Iush> getMeffs() {
        ...
    }

    public String getNosvi() {
        ...
    }
}

public class Flep extends Diour {
    public List<Masmost> getPeacs() {
        ...
    }
}

public class Ibrac extends IusOinpha {
    public Uicbri getEspo() {
        ...
    }
}

public class IodCeu {
    public List<String> getReph() {
        ...
    }

    public Prouc getAlAel() {
        ...
    }
}

public class IusOinpha {
    public String getMuan() {
        ...
    }
}

public class Iush {
    public byte[] getReng() {
        ...
    }

    public Selasm getHuOpid() {
        ...
    }
}

public class Masmost {
    public String getEtBaror() {
        ...
    }
}

public class Olknast {
    public byte[] getRetul() {
        ...
    }

    public List<Vantclu> getOaUls() {
        ...
    }

    public File getSmon() {
        ...
    }
}

public class Prouc {
    public byte[] getAswu() {
        ...
    }
}

public class PsaRercaumph {
    public int getOsm() {
        ...
    }
}

public class Selasm extends Uros {
    public List<String> getThi() {
        ...
    }
}

public class Teec extends Dreoss {
    public CocPif getUkIr() {
        ...
    }
}

public class Uicbri extends Eent {
    public PsaRercaumph getDiThil() {
        ...
    }
}

public class Uros {
    public IodCeu getOed() {
        ...
    }

    public Olknast getUdCo() {
        ...
    }
}

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

    Flep fa

    ...and the following method:

    public void process(File item)

    ...write code to process the smon of each meff of the first papo of each oeant of fa.

    Solution

    for (Ibrac papo : fa.getDiour().getOeants().get(0).getUkIr().getPaposList()) {
        process(papo.getEspo().getEent().getMeffs().get(0).getHuOpid().getUros().getUdCo().getSmon());
    }

Related puzzles: