Class relationships: Correct Solution


Consider the follow class declarations:

public class Aschill extends Coonk {
    public List<Mengack> getIssans() {
        ...
    }
}

public class Ascho {
    public Ermru getMert() {
        ...
    }

    public List<Homb> getCeltis() {
        ...
    }
}

public class Caedbess extends Manbac {
    public TeiIcsess getIphil() {
        ...
    }

    public List<Wennil> getTeIndos() {
        ...
    }
}

public class CinSwi {
    public int getFlund() {
        ...
    }
}

public class Coonk {
    public Caedbess getIcer() {
        ...
    }

    public Musced getFenhe() {
        ...
    }
}

public class Ermru extends Sano {
    public int getScri() {
        ...
    }
}

public class Hiost {
    public List<PidCau> getTrers() {
        ...
    }

    public Scinksnes getWeut() {
        ...
    }

    public Ptissco getDaAdpra() {
        ...
    }
}

public class Homb {
    public List<String> getJaEmi() {
        ...
    }
}

public class Liucak {
    public List<String> getCrio() {
        ...
    }

    public List<Aschill> getCeghts() {
        ...
    }
}

public class Manbac {
    public List<Ascho> getSaSos() {
        ...
    }

    public int getMiad() {
        ...
    }
}

public class Mengack {
    public String getOpon() {
        ...
    }
}

public class Musced {
    public int getNener() {
        ...
    }
}

public class Phan {
    public String getSheut() {
        ...
    }
}

public class PidCau {
    public Liucak getSor() {
        ...
    }

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

public class Pras extends Hiost {
    public String getUious() {
        ...
    }
}

public class Ptissco {
    public String getBaSino() {
        ...
    }
}

public class Sano extends Phan {
    public List<CinSwi> getWies() {
        ...
    }

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

public class Scinksnes {
    public int getRosu() {
        ...
    }
}

public class TeiIcsess {
    public String getHici() {
        ...
    }
}

public class Wennil {
    public byte[] getFiBi() {
        ...
    }
}
  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:

    Pras od

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the foThepo of each saSo of each ceght of the first trer of od.

    Solution

    for (PidCau trer : od.getHiost().getTrersList()) {
        process(trer.getSor().getCeghts().get(0).getCoonk().getIcer().getManbac().getSaSos().get(0).getMert().getSano().getFoThepo());
    }

Related puzzles: