Class relationships: Correct Solution


Consider the follow class declarations:

public class Cred {
    public int getOnMafsi() {
        ...
    }
}

public class Cruun {
    public List<String> getCisme() {
        ...
    }

    public List<Ghida> getNins() {
        ...
    }
}

public class Daen {
    public List<String> getNossa() {
        ...
    }
}

public class Dastal extends Prari {
    public Daen getHoerd() {
        ...
    }
}

public class Delbist {
    public File getUnAsm() {
        ...
    }
}

public class Dickbel {
    public int getNaShro() {
        ...
    }
}

public class EckInil {
    public List<Delbist> getIdSpis() {
        ...
    }

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

public class Flass {
    public int getCenta() {
        ...
    }
}

public class Ghida {
    public File getRaca() {
        ...
    }

    public Qoictcerd getPri() {
        ...
    }
}

public class Hosm {
    public List<Dastal> getToods() {
        ...
    }

    public File getEsm() {
        ...
    }
}

public class Isrel {
    public Pancer getCiSied() {
        ...
    }

    public TudBilba getUlNioli() {
        ...
    }
}

public class Laess extends Dickbel {
    public List<Isrel> getDeOcs() {
        ...
    }
}

public class Lelsti {
    public List<String> getIlDawi() {
        ...
    }
}

public class Orno {
    public File getPran() {
        ...
    }

    public String getFaTi() {
        ...
    }
}

public class Pancer {
    public File getAsShec() {
        ...
    }
}

public class Prari {
    public Orno getMeve() {
        ...
    }

    public int getPoing() {
        ...
    }
}

public class Psoe extends Hosm {
    public List<SloIen> getMabics() {
        ...
    }
}

public class Qersed extends Flass {
    public Laess getNoHi() {
        ...
    }

    public Lelsti getBeo() {
        ...
    }
}

public class Qoictcerd extends Qersed {
    public List<EckInil> getMaAstiks() {
        ...
    }
}

public class Rass {
    public int getKhial() {
        ...
    }
}

public class Scosmsorm {
    public List<String> getFaten() {
        ...
    }
}

public class Sidcu extends Cruun {
    public byte[] getWras() {
        ...
    }
}

public class SloIen {
    public String getPaBishe() {
        ...
    }

    public List<Cred> getPhens() {
        ...
    }
}

public class TudBilba {
    public Rass getLafo() {
        ...
    }

    public List<Psoe> getFleous() {
        ...
    }

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

    Sidcu nasm

    ...and the following method:

    public void process(String item)

    ...write code to process the faTi of each tood of each fleou of each deOc of the first nin of nasm.

    Solution

    for (Ghida nin : nasm.getCruun().getNinsList()) {
        process(nin.getPri().getQersed().getNoHi().getDeOcs().get(0).getUlNioli().getFleous().get(0).getHosm().getToods().get(0).getPrari().getMeve().getFaTi());
    }

Related puzzles: