Class relationships: Correct Solution


Consider the follow class declarations:

public class Amsco extends Phin {
    public byte[] getFiAl() {
        ...
    }
}

public class Esaz {
    public Sesmi getRhec() {
        ...
    }

    public String getCiVude() {
        ...
    }
}

public class EudTrirmress {
    public String getPlupo() {
        ...
    }
}

public class Halpie {
    public String getCoIr() {
        ...
    }

    public List<Meage> getMidcis() {
        ...
    }
}

public class Heedgier {
    public List<Preshsput> getNeNos() {
        ...
    }

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

public class Heso {
    public String getEerp() {
        ...
    }
}

public class Meage extends Esaz {
    public int getTiOn() {
        ...
    }
}

public class NuoMening {
    public String getPoFebir() {
        ...
    }
}

public class Palvim extends Heedgier {
    public int getEsSasm() {
        ...
    }
}

public class Phassvend {
    public int getSaRi() {
        ...
    }
}

public class Phin extends EudTrirmress {
    public List<Heso> getSnas() {
        ...
    }

    public List<Sotchbiol> getUjods() {
        ...
    }
}

public class Preshsput {
    public File getUsCach() {
        ...
    }

    public Phassvend getNasec() {
        ...
    }
}

public class Sesmi extends Stro {
    public int getLia() {
        ...
    }
}

public class Sotchbiol {
    public Wrelo getDaIl() {
        ...
    }

    public int getIahim() {
        ...
    }
}

public class Stro {
    public Palvim getRupas() {
        ...
    }

    public List<NuoMening> getEuacs() {
        ...
    }

    public int getChio() {
        ...
    }
}

public class Wrelo {
    public Halpie getOpra() {
        ...
    }

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

    Amsco oo

    ...and the following method:

    public void process(int item)

    ...write code to process the chio of each midci of the first ujod of oo.

    Solution

    for (Sotchbiol ujod : oo.getPhin().getUjodsList()) {
        process(ujod.getDaIl().getOpra().getMidcis().get(0).getEsaz().getRhec().getStro().getChio());
    }

Related puzzles: