Class relationships: Correct Solution


Consider the follow class declarations:

public class Acik extends Sece {
    public Iaro getSqu() {
        ...
    }

    public Belent getInIl() {
        ...
    }
}

public class Belent extends Qaer {
    public List<String> getOsPesm() {
        ...
    }
}

public class Bror {
    public byte[] getIocre() {
        ...
    }
}

public class CedMorman {
    public byte[] getOugos() {
        ...
    }
}

public class CinFultar {
    public int getHeEpuod() {
        ...
    }
}

public class Esong extends Hefe {
    public List<Zagrin> getIeos() {
        ...
    }

    public List<Trarmmo> getCers() {
        ...
    }

    public CinFultar getRui() {
        ...
    }
}

public class Fialf {
    public File getReang() {
        ...
    }
}

public class Glontmiom extends PidIngthuc {
    public int getRasm() {
        ...
    }
}

public class Hefe {
    public byte[] getPoBrer() {
        ...
    }
}

public class Iaro {
    public int getBotco() {
        ...
    }
}

public class Nalcean {
    public String getPeka() {
        ...
    }

    public Esong getXiBe() {
        ...
    }
}

public class NerCovec extends Bror {
    public Pidcan getPhan() {
        ...
    }
}

public class PidIngthuc {
    public List<Acik> getTres() {
        ...
    }

    public File getNeRur() {
        ...
    }
}

public class Pidcan extends Warnip {
    public String getWuErhoi() {
        ...
    }
}

public class Qaer {
    public Smapium getBosm() {
        ...
    }

    public List<Sninsqi> getTaEhas() {
        ...
    }

    public List<Nalcean> getIils() {
        ...
    }
}

public class Sece {
    public List<String> getOnZaswi() {
        ...
    }
}

public class Smapium {
    public List<String> getUdAr() {
        ...
    }
}

public class Sninsqi {
    public int getImas() {
        ...
    }
}

public class ThuSpippro {
    public String getFaeon() {
        ...
    }

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

public class Trarmmo extends ThuSpippro {
    public List<Fialf> getEnads() {
        ...
    }
}

public class Warnip {
    public List<Glontmiom> getOgangs() {
        ...
    }

    public CedMorman getPeIciad() {
        ...
    }
}

public class Zagrin {
    public File getOrAn() {
        ...
    }
}
  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:

    NerCovec esm

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the kiam of the first cer of each iil of each tre of the first ogang of esm.

    Solution

    for (Glontmiom ogang : esm.getPhan().getWarnip().getOgangsList()) {
        for (Trarmmo cer : ogang.getPidIngthuc().getTres().get(0).getInIl().getQaer().getIils().get(0).getXiBe().getCersList()) {
            process(cer.getThuSpippro().getKiam());
        }
    }

Related puzzles: