Class relationships: Correct Solution


Consider the follow class declarations:

public class Anirm {
    public List<String> getMorci() {
        ...
    }

    public List<ErmFri> getTiWopuls() {
        ...
    }
}

public class Ashstir {
    public List<Pouho> getIoDesms() {
        ...
    }

    public int getEnDefu() {
        ...
    }
}

public class Bongba {
    public List<Inent> getPocads() {
        ...
    }

    public Trese getZiDi() {
        ...
    }
}

public class Chru extends Bongba {
    public byte[] getCepli() {
        ...
    }
}

public class Dotpin extends Ashstir {
    public Zelo getIdFicmi() {
        ...
    }

    public File getIec() {
        ...
    }
}

public class Elack {
    public String getFeuw() {
        ...
    }

    public List<Missont> getCirnus() {
        ...
    }
}

public class ErmFri {
    public Chru getSle() {
        ...
    }

    public List<Oant> getEvools() {
        ...
    }
}

public class Iade {
    public List<String> getHonec() {
        ...
    }
}

public class Inent {
    public File getEmiu() {
        ...
    }
}

public class Kall extends Iade {
    public List<String> getIrHimad() {
        ...
    }
}

public class Mawo {
    public String getPePa() {
        ...
    }
}

public class Missont extends Necs {
    public String getSaioc() {
        ...
    }
}

public class Necs {
    public Psap getEong() {
        ...
    }

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

public class Oant {
    public byte[] getKnama() {
        ...
    }
}

public class Pouho {
    public List<String> getUpra() {
        ...
    }
}

public class Psap extends Mawo {
    public List<Seurve> getPris() {
        ...
    }

    public List<Stro> getGerns() {
        ...
    }

    public Kall getPoHapre() {
        ...
    }
}

public class Seurve {
    public Dotpin getAol() {
        ...
    }

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

public class Stro {
    public File getDewen() {
        ...
    }
}

public class Trese extends Elack {
    public List<String> getFoc() {
        ...
    }
}

public class Zelo {
    public String getUnSush() {
        ...
    }
}
  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:

    Anirm a

    ...and the following method:

    public void process(File item)

    ...write code to process the iec of the first pri of the first cirnu of each tiWopul of a.

    Solution

    for (Missont cirnu : a.getTiWopuls().get(0).getSle().getBongba().getZiDi().getElack().getCirnusList()) {
        for (Seurve pri : cirnu.getNecs().getEong().getPrisList()) {
            process(pri.getAol().getIec());
        }
    }

Related puzzles: