Class relationships: Correct Solution


Consider the follow class declarations:

public class Assoss {
    public File getSesge() {
        ...
    }

    public Zoustspos getNeeg() {
        ...
    }
}

public class Bralshe extends Assoss {
    public String getSaCenca() {
        ...
    }
}

public class Coih {
    public int getOght() {
        ...
    }
}

public class Eluid {
    public String getPiac() {
        ...
    }
}

public class Heaner {
    public Spedcre getLuad() {
        ...
    }

    public int getXon() {
        ...
    }
}

public class Oldaust extends Coih {
    public List<Bralshe> getKels() {
        ...
    }

    public Slisfil getSesm() {
        ...
    }
}

public class Ossul {
    public String getNuQerk() {
        ...
    }
}

public class Slisfil {
    public byte[] getIid() {
        ...
    }
}

public class Spedcre extends Oldaust {
    public List<Ossul> getViChras() {
        ...
    }
}

public class Zoustspos {
    public String getKeud() {
        ...
    }

    public List<Eluid> getHeBicars() {
        ...
    }

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

    Heaner osim

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the hos of the first kel of osim.

    Solution

    for (Bralshe kel : osim.getLuad().getOldaust().getKelsList()) {
        process(kel.getAssoss().getNeeg().getHos());
    }

Related puzzles: