Class relationships: Correct Solution


Consider the follow class declarations:

public class Astcli {
    public List<String> getLus() {
        ...
    }
}

public class Camud extends Pangmi {
    public Tihas getRiBe() {
        ...
    }
}

public class Cemal {
    public String getMiBedsi() {
        ...
    }

    public Nuinon getAnAsgo() {
        ...
    }
}

public class Chumua {
    public File getIdSedis() {
        ...
    }

    public Conbess getMuJocvo() {
        ...
    }
}

public class Conbess extends Lertec {
    public List<Idar> getSposms() {
        ...
    }
}

public class Dorlen extends Feovon {
    public List<String> getOkass() {
        ...
    }
}

public class DreNesbo {
    public int getAsIa() {
        ...
    }
}

public class Feca extends Chumua {
    public List<Hacthi> getDiDas() {
        ...
    }

    public Cemal getHaMe() {
        ...
    }

    public List<Icsoph> getEnts() {
        ...
    }
}

public class Feovon {
    public List<String> getBefel() {
        ...
    }

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

public class Grorxi extends Astcli {
    public List<Dorlen> getSors() {
        ...
    }
}

public class Hacthi extends Xanpeu {
    public File getWhio() {
        ...
    }
}

public class Icsoph {
    public int getChrat() {
        ...
    }
}

public class Idar {
    public byte[] getKeNutoe() {
        ...
    }
}

public class Lertec {
    public File getScoce() {
        ...
    }

    public List<OanAng> getFleses() {
        ...
    }
}

public class Nuinon {
    public int getNeBu() {
        ...
    }
}

public class OanAng {
    public Tiofan getRhama() {
        ...
    }

    public Grorxi getPaa() {
        ...
    }
}

public class Pangmi {
    public String getLePror() {
        ...
    }
}

public class Ronwi {
    public String getGlier() {
        ...
    }

    public List<Camud> getMaiins() {
        ...
    }
}

public class Tihas {
    public List<Feca> getBeffs() {
        ...
    }

    public DreNesbo getCrir() {
        ...
    }
}

public class Tiofan {
    public byte[] getErm() {
        ...
    }
}

public class Urre extends Ronwi {
    public File getHous() {
        ...
    }
}

public class Xanpeu {
    public List<String> getDened() {
        ...
    }
}
  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:

    Urre phe

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the ciMerm of the first sor of the first fles of the first beff of each maiin of phe.

    Solution

    for (Feca beff : phe.getRonwi().getMaiins().get(0).getRiBe().getBeffsList()) {
        for (OanAng fles : beff.getChumua().getMuJocvo().getLertec().getFlesesList()) {
            for (Dorlen sor : fles.getPaa().getSorsList()) {
                process(sor.getFeovon().getCiMerm());
            }
        }
    }

Related puzzles: