Class relationships: Correct Solution


Consider the follow class declarations:

public class Cilbi {
    public List<String> getPraa() {
        ...
    }
}

public class Droaic {
    public String getMidce() {
        ...
    }
}

public class Endi extends Rormos {
    public Whona getAnFocet() {
        ...
    }
}

public class Engsall {
    public int getSiEsan() {
        ...
    }
}

public class Espa {
    public File getOrAphol() {
        ...
    }
}

public class Fealpi {
    public List<Gienil> getPrafis() {
        ...
    }

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

public class Gienil extends Robro {
    public int getMurda() {
        ...
    }
}

public class Itsan extends Specre {
    public Espa getUrPa() {
        ...
    }
}

public class NirPlewnea {
    public Pera getCeabu() {
        ...
    }

    public String getEnFoxio() {
        ...
    }
}

public class Pera {
    public Droaic getNel() {
        ...
    }

    public Fealpi getPadpi() {
        ...
    }
}

public class Phuss {
    public File getTro() {
        ...
    }
}

public class Robro {
    public List<Xire> getIkiots() {
        ...
    }

    public List<Vifuc> getBrares() {
        ...
    }

    public List<Spria> getArotses() {
        ...
    }
}

public class Rormos extends Schisuff {
    public int getOldin() {
        ...
    }
}

public class Schisuff {
    public int getRor() {
        ...
    }

    public String getEua() {
        ...
    }
}

public class Specre {
    public byte[] getCles() {
        ...
    }

    public List<NirPlewnea> getWoBrecs() {
        ...
    }
}

public class Sphe extends Engsall {
    public List<Cilbi> getLells() {
        ...
    }
}

public class Spria extends Phuss {
    public Endi getCiPraen() {
        ...
    }
}

public class Vifuc {
    public String getEdi() {
        ...
    }
}

public class Whona {
    public byte[] getBisca() {
        ...
    }

    public List<Sphe> getAmios() {
        ...
    }
}

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

    Itsan garm

    ...and the following method:

    public void process(String item)

    ...write code to process the eua of the first arots of the first prafi of the first woBrec of garm.

    Solution

    for (NirPlewnea woBrec : garm.getSpecre().getWoBrecsList()) {
        for (Gienil prafi : woBrec.getCeabu().getPadpi().getPrafisList()) {
            for (Spria arots : prafi.getRobro().getArotsesList()) {
                process(arots.getCiPraen().getRormos().getSchisuff().getEua());
            }
        }
    }

Related puzzles: