Class relationships: Correct Solution


Consider the follow class declarations:

public class Coscos {
    public Pronpuid getEanbe() {
        ...
    }

    public List<Sauol> getOderms() {
        ...
    }

    public QosAng getBiss() {
        ...
    }
}

public class Dopniu {
    public String getPec() {
        ...
    }

    public File getIedne() {
        ...
    }
}

public class Enscros {
    public byte[] getVoss() {
        ...
    }
}

public class Essqe {
    public List<String> getPoDantu() {
        ...
    }
}

public class Feoght {
    public List<Pisssco> getZems() {
        ...
    }

    public Tehup getCimar() {
        ...
    }

    public List<Dopniu> getUsses() {
        ...
    }
}

public class Neghtcec {
    public byte[] getSeet() {
        ...
    }
}

public class Nersnod {
    public String getHePse() {
        ...
    }
}

public class Osger {
    public Feoght getCapin() {
        ...
    }

    public int getLiShert() {
        ...
    }
}

public class Peilph extends Osger {
    public byte[] getHabos() {
        ...
    }
}

public class Peoi {
    public Peilph getIuIeng() {
        ...
    }

    public Enscros getSaNo() {
        ...
    }
}

public class Pimerd {
    public Nersnod getEstda() {
        ...
    }

    public List<Coscos> getZors() {
        ...
    }
}

public class Pisssco {
    public String getCioi() {
        ...
    }
}

public class Pronpuid extends Ranin {
    public int getCedo() {
        ...
    }
}

public class QosAng {
    public String getPran() {
        ...
    }
}

public class Ranin {
    public String getSwia() {
        ...
    }

    public List<Peoi> getCeudes() {
        ...
    }
}

public class Ress extends Pimerd {
    public List<Essqe> getMeCernus() {
        ...
    }

    public List<Neghtcec> getEnnels() {
        ...
    }
}

public class Sauol {
    public String getPaRi() {
        ...
    }
}

public class Tehup {
    public byte[] getReng() {
        ...
    }
}
  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:

    Ress tru

    ...and the following method:

    public void process(File item)

    ...write code to process the iedne of the first uss of the first ceude of the first zor of tru.

    Solution

    for (Coscos zor : tru.getPimerd().getZorsList()) {
        for (Peoi ceude : zor.getEanbe().getRanin().getCeudesList()) {
            for (Dopniu uss : ceude.getIuIeng().getOsger().getCapin().getUssesList()) {
                process(uss.getIedne());
            }
        }
    }

Related puzzles: