Class relationships: Correct Solution


Consider the follow class declarations:

public class Cospend {
    public String getScac() {
        ...
    }
}

public class Crasi {
    public File getAeirm() {
        ...
    }
}

public class Dentac {
    public byte[] getChes() {
        ...
    }

    public Reshess getHoOc() {
        ...
    }
}

public class Hintteum {
    public int getDaHeur() {
        ...
    }

    public List<Hontsaen> getOlSus() {
        ...
    }
}

public class Hontsaen {
    public int getSio() {
        ...
    }

    public String getPri() {
        ...
    }
}

public class Ithprur {
    public File getPhobo() {
        ...
    }

    public Crasi getEsStous() {
        ...
    }
}

public class Nonto extends Ithprur {
    public List<Hintteum> getSeous() {
        ...
    }
}

public class Reshess extends Nonto {
    public List<Cospend> getOnds() {
        ...
    }
}
  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:

    Dentac va

    ...and the following method:

    public void process(String item)

    ...write code to process the pri of each olSu of the first seou of va.

    Solution

    for (Hintteum seou : va.getHoOc().getNonto().getSeousList()) {
        process(seou.getOlSus().get(0).getPri());
    }

Related puzzles: