Class relationships: Correct Solution


Consider the follow class declarations:

public class Aspass {
    public byte[] getRup() {
        ...
    }
}

public class Becce {
    public Thrisoc getSpioc() {
        ...
    }

    public Blushthish getPaPrap() {
        ...
    }
}

public class Blushthish {
    public int getFlir() {
        ...
    }

    public Piio getPeEstdo() {
        ...
    }
}

public class Briexoss extends Ciosh {
    public List<Cailes> getScings() {
        ...
    }

    public Prostshad getWaNi() {
        ...
    }
}

public class Cailes {
    public byte[] getUsSitpe() {
        ...
    }
}

public class Ciosh {
    public int getOmre() {
        ...
    }
}

public class Ciwe {
    public List<Becce> getGiis() {
        ...
    }

    public String getAng() {
        ...
    }
}

public class Cupen {
    public List<String> getRibu() {
        ...
    }

    public int getKeCibu() {
        ...
    }
}

public class Emstam {
    public List<QirRhale> getElads() {
        ...
    }

    public Plar getEao() {
        ...
    }
}

public class Iasast {
    public Irmang getAnma() {
        ...
    }

    public List<Aspass> getSeskus() {
        ...
    }
}

public class IriThros {
    public int getScri() {
        ...
    }
}

public class Irmang extends IriThros {
    public File getWhape() {
        ...
    }
}

public class Lancia extends Prelio {
    public List<Lebea> getTaPulges() {
        ...
    }

    public Thiss getIsPread() {
        ...
    }
}

public class Lebea {
    public byte[] getIlhec() {
        ...
    }
}

public class Osmti {
    public Lancia getFiPrac() {
        ...
    }

    public List<Posasm> getOpSeings() {
        ...
    }
}

public class Piio {
    public byte[] getCacod() {
        ...
    }

    public List<Xair> getTeis() {
        ...
    }
}

public class Plar extends Iasast {
    public List<String> getWiCapha() {
        ...
    }
}

public class Posasm {
    public byte[] getIndo() {
        ...
    }
}

public class Prelio {
    public List<String> getAnol() {
        ...
    }

    public List<Emstam> getUnds() {
        ...
    }
}

public class Prostshad extends Ciwe {
    public File getPles() {
        ...
    }
}

public class QirRhale extends Briexoss {
    public List<String> getTwe() {
        ...
    }
}

public class Thiss {
    public String getPeass() {
        ...
    }
}

public class Thrisoc {
    public int getMopul() {
        ...
    }
}

public class Xair extends Cupen {
    public File getEpang() {
        ...
    }
}
  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:

    Osmti cil

    ...and the following method:

    public void process(int item)

    ...write code to process the keCibu of each tei of the first gii of the first elad of the first und of cil.

    Solution

    for (Emstam und : cil.getFiPrac().getPrelio().getUndsList()) {
        for (QirRhale elad : und.getEladsList()) {
            for (Becce gii : elad.getBriexoss().getWaNi().getCiwe().getGiisList()) {
                process(gii.getPaPrap().getPeEstdo().getTeis().get(0).getCupen().getKeCibu());
            }
        }
    }

Related puzzles: