Class relationships: Correct Solution


Consider the follow class declarations:

public class Assgan {
    public Irfe getPoIllpu() {
        ...
    }

    public String getUlSesoa() {
        ...
    }
}

public class Asssit extends Prouo {
    public Clusea getSance() {
        ...
    }
}

public class Benspeor extends Brelphe {
    public Prerd getScrel() {
        ...
    }
}

public class Brelphe {
    public List<Rende> getAdPras() {
        ...
    }

    public String getShiom() {
        ...
    }
}

public class Ceng extends Assgan {
    public List<Qansar> getRospes() {
        ...
    }
}

public class Cerol {
    public Ceng getDaIrch() {
        ...
    }

    public List<Hubi> getCocs() {
        ...
    }
}

public class Clusea {
    public int getArHi() {
        ...
    }
}

public class DukFandi {
    public String getBuHacpa() {
        ...
    }
}

public class Ecriant {
    public byte[] getMafo() {
        ...
    }
}

public class Estriapt {
    public Ecriant getGoiec() {
        ...
    }

    public List<Sormou> getOiAcs() {
        ...
    }

    public int getOsh() {
        ...
    }
}

public class Hubi {
    public List<DukFandi> getMecs() {
        ...
    }

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

public class Irfe {
    public String getIcea() {
        ...
    }
}

public class Nashden {
    public String getAxCint() {
        ...
    }
}

public class Plias extends Estriapt {
    public List<String> getRaTeus() {
        ...
    }
}

public class Prerd {
    public byte[] getIien() {
        ...
    }
}

public class Prouo {
    public int getIin() {
        ...
    }

    public List<Cerol> getEhers() {
        ...
    }
}

public class Qansar extends Benspeor {
    public List<String> getHeaec() {
        ...
    }
}

public class Rende extends Nashden {
    public Plias getIcUnlac() {
        ...
    }
}

public class Rusnarm {
    public Asssit getTroo() {
        ...
    }

    public List<String> getTaCin() {
        ...
    }
}

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

    Rusnarm cuc

    ...and the following method:

    public void process(int item)

    ...write code to process the osh of the first adPra of each rospe of each eher of cuc.

    Solution

    for (Rende adPra : cuc.getTroo().getProuo().getEhers().get(0).getDaIrch().getRospes().get(0).getBenspeor().getBrelphe().getAdPrasList()) {
        process(adPra.getIcUnlac().getEstriapt().getOsh());
    }

Related puzzles: