Class relationships: Correct Solution


Consider the follow class declarations:

public class Debrost {
    public byte[] getUsRe() {
        ...
    }
}

public class Destnall {
    public File getLaDe() {
        ...
    }

    public Suhett getTrud() {
        ...
    }
}

public class Dioci {
    public byte[] getInma() {
        ...
    }
}

public class Ednal {
    public File getPurm() {
        ...
    }

    public List<Debrost> getIeEosses() {
        ...
    }

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

public class Focic {
    public Pupork getCiol() {
        ...
    }

    public File getPra() {
        ...
    }
}

public class Glicas extends Stansing {
    public List<String> getEper() {
        ...
    }
}

public class Nactis extends Splo {
    public File getNiPhaw() {
        ...
    }
}

public class Pessmist {
    public File getLiOpsi() {
        ...
    }
}

public class Pupork extends Destnall {
    public int getSuFic() {
        ...
    }
}

public class Splo {
    public List<Glicas> getSupros() {
        ...
    }

    public List<Focic> getCiSpacs() {
        ...
    }
}

public class Stansing {
    public Pessmist getSoProll() {
        ...
    }

    public File getMaMul() {
        ...
    }
}

public class Suhett {
    public Dioci getErbas() {
        ...
    }

    public List<Ednal> getBaPsos() {
        ...
    }
}
  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:

    Nactis od

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the twui of each baPso of each ciSpac of od.

    Solution

    process(od.getSplo().getCiSpacs().get(0).getCiol().getDestnall().getTrud().getBaPsos().get(0).getTwui());

Related puzzles: