Class relationships: Correct Solution


Consider the follow class declarations:

public class Asmdar {
    public Kergir getRuc() {
        ...
    }

    public String getMec() {
        ...
    }
}

public class Ceswil {
    public List<Asmdar> getChoxs() {
        ...
    }

    public Eastiph getAght() {
        ...
    }
}

public class Ciocsprut {
    public List<QarAwbus> getCacmus() {
        ...
    }

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

public class Coptcle extends Rass {
    public Narple getFian() {
        ...
    }

    public Moufrud getSest() {
        ...
    }
}

public class Eastiph {
    public int getPlusm() {
        ...
    }
}

public class Fesliust {
    public File getJeat() {
        ...
    }

    public Coptcle getCesh() {
        ...
    }
}

public class Gadche {
    public String getPlouc() {
        ...
    }
}

public class Grewnsar extends Gadche {
    public List<Scra> getStons() {
        ...
    }
}

public class Horb {
    public byte[] getEoSqoc() {
        ...
    }
}

public class Kergir extends Knuh {
    public Grewnsar getPra() {
        ...
    }

    public List<Sclic> getOnBeurs() {
        ...
    }
}

public class Knuh {
    public File getHoTo() {
        ...
    }

    public Relmess getHepsi() {
        ...
    }

    public int getPhrer() {
        ...
    }
}

public class LiaMosus extends Ciocsprut {
    public File getEmuec() {
        ...
    }
}

public class Mawo extends Nuand {
    public List<Taio> getSases() {
        ...
    }

    public Sesmpro getOst() {
        ...
    }
}

public class Moufrud {
    public File getSner() {
        ...
    }
}

public class Narple {
    public List<SloLesshir> getNoCatmus() {
        ...
    }

    public int getIsKak() {
        ...
    }
}

public class Nuand {
    public String getIssle() {
        ...
    }
}

public class QarAwbus extends Fesliust {
    public int getVism() {
        ...
    }
}

public class Rass {
    public String getItic() {
        ...
    }
}

public class Relmess {
    public String getCeHese() {
        ...
    }
}

public class Sclic {
    public List<String> getMuap() {
        ...
    }
}

public class Scra {
    public byte[] getBrer() {
        ...
    }
}

public class Sesmpro {
    public String getPucid() {
        ...
    }

    public List<LiaMosus> getCris() {
        ...
    }
}

public class SloLesshir extends Ceswil {
    public List<Horb> getOsducs() {
        ...
    }
}

public class Taio {
    public int getUirme() {
        ...
    }
}
  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:

    Mawo dou

    ...and the following method:

    public void process(int item)

    ...write code to process the phrer of the first chox of each noCatmu of the first cacmu of each cri of dou.

    Solution

    for (QarAwbus cacmu : dou.getOst().getCris().get(0).getCiocsprut().getCacmusList()) {
        for (Asmdar chox : cacmu.getFesliust().getCesh().getFian().getNoCatmus().get(0).getCeswil().getChoxsList()) {
            process(chox.getRuc().getKnuh().getPhrer());
        }
    }

Related puzzles: