Class relationships: Correct Solution


Consider the follow class declarations:

public class BouAac {
    public String getBeRhes() {
        ...
    }
}

public class Debual extends Heostsa {
    public List<Vianbec> getSaxins() {
        ...
    }
}

public class Froge {
    public List<Olsce> getIdOrs() {
        ...
    }

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

public class Heostsa {
    public List<String> getCes() {
        ...
    }
}

public class Iommes extends Froge {
    public Prae getOrbe() {
        ...
    }
}

public class Olsce {
    public List<Tuida> getEfPas() {
        ...
    }

    public Debual getIxe() {
        ...
    }
}

public class OngPraneght {
    public String getReng() {
        ...
    }
}

public class Orgeod {
    public List<String> getWoPe() {
        ...
    }

    public int getSnex() {
        ...
    }
}

public class Pentca extends BouAac {
    public List<String> getPhe() {
        ...
    }
}

public class Prae {
    public String getFrul() {
        ...
    }
}

public class Reess {
    public Secling getMePran() {
        ...
    }

    public List<SasCicho> getGosts() {
        ...
    }
}

public class SasCicho {
    public byte[] getPuAan() {
        ...
    }
}

public class Scruc extends Reess {
    public String getHerph() {
        ...
    }
}

public class Secling extends Pentca {
    public List<Orgeod> getCebexs() {
        ...
    }
}

public class Tuida {
    public List<String> getGrul() {
        ...
    }
}

public class Vianbec {
    public OngPraneght getRirm() {
        ...
    }

    public Scruc getLioss() {
        ...
    }
}
  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:

    Iommes sini

    ...and the following method:

    public void process(int item)

    ...write code to process the snex of each cebex of each saxin of the first idOr of sini.

    Solution

    for (Olsce idOr : sini.getFroge().getIdOrsList()) {
        process(idOr.getIxe().getSaxins().get(0).getLioss().getReess().getMePran().getCebexs().get(0).getSnex());
    }

Related puzzles: