Class relationships: Correct Solution


Consider the follow class declarations:

public class Amous extends Rontse {
    public Cins getCoar() {
        ...
    }

    public List<GruSardspel> getImSteses() {
        ...
    }
}

public class Angir {
    public String getPopa() {
        ...
    }

    public BoiQac getBengo() {
        ...
    }
}

public class BoiQac {
    public Pansta getOim() {
        ...
    }

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

public class Cins {
    public List<Soint> getIsDes() {
        ...
    }

    public Seckrent getPoed() {
        ...
    }
}

public class FriEwesh {
    public List<String> getEdFii() {
        ...
    }
}

public class GruSardspel {
    public String getKig() {
        ...
    }
}

public class Heltil {
    public List<Osmint> getLecs() {
        ...
    }

    public Sedi getAoss() {
        ...
    }

    public String getPrent() {
        ...
    }
}

public class Oris extends Heltil {
    public byte[] getSwas() {
        ...
    }
}

public class Osmint extends FriEwesh {
    public File getOsNarmi() {
        ...
    }
}

public class Pansta extends Pepi {
    public byte[] getEso() {
        ...
    }
}

public class Pepi {
    public String getEort() {
        ...
    }

    public List<Sumoul> getNoSpeons() {
        ...
    }
}

public class Rontse {
    public List<Angir> getItros() {
        ...
    }

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

public class Schaci {
    public File getWroer() {
        ...
    }

    public List<Oris> getMoEcids() {
        ...
    }
}

public class Seckrent {
    public String getFious() {
        ...
    }
}

public class Sedi {
    public byte[] getEgec() {
        ...
    }
}

public class SesReu {
    public String getTiNia() {
        ...
    }
}

public class Soint {
    public List<String> getTiaeo() {
        ...
    }
}

public class Sumoul extends SesReu {
    public Schaci getLemi() {
        ...
    }
}
  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:

    Amous ies

    ...and the following method:

    public void process(String item)

    ...write code to process the prent of the first moEcid of the first noSpeon of each itro of ies.

    Solution

    for (Sumoul noSpeon : ies.getRontse().getItros().get(0).getBengo().getOim().getPepi().getNoSpeonsList()) {
        for (Oris moEcid : noSpeon.getLemi().getMoEcidsList()) {
            process(moEcid.getHeltil().getPrent());
        }
    }

Related puzzles: