Class relationships: Correct Solution


Consider the follow class declarations:

public class Badstu extends CesLelpeic {
    public int getAaNo() {
        ...
    }
}

public class Blangpric {
    public int getPaunt() {
        ...
    }
}

public class Camnstenth {
    public File getIdi() {
        ...
    }

    public List<Mecmes> getInnuls() {
        ...
    }
}

public class CesLelpeic {
    public int getQenfo() {
        ...
    }

    public List<Camnstenth> getEsAeols() {
        ...
    }
}

public class CipMagior {
    public String getMoOang() {
        ...
    }
}

public class Dongi {
    public List<String> getUsTerl() {
        ...
    }

    public String getTuil() {
        ...
    }
}

public class Gunth {
    public int getRescu() {
        ...
    }
}

public class Mecmes extends Gunth {
    public Susqa getProir() {
        ...
    }

    public List<Qiac> getPios() {
        ...
    }
}

public class Prurm {
    public byte[] getPse() {
        ...
    }
}

public class Qiac {
    public File getPec() {
        ...
    }
}

public class Riess {
    public byte[] getAnuim() {
        ...
    }
}

public class Stiss {
    public File getMorm() {
        ...
    }

    public Badstu getResmo() {
        ...
    }
}

public class Susqa extends Trento {
    public CipMagior getEnt() {
        ...
    }

    public Blangpric getLios() {
        ...
    }
}

public class Trento extends Riess {
    public List<Dongi> getOmads() {
        ...
    }

    public List<Prurm> getShungs() {
        ...
    }
}
  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:

    Stiss sasm

    ...and the following method:

    public void process(String item)

    ...write code to process the tuil of each omad of each innul of each esAeol of sasm.

    Solution

    process(sasm.getResmo().getCesLelpeic().getEsAeols().get(0).getInnuls().get(0).getProir().getTrento().getOmads().get(0).getTuil());

Related puzzles: