Class relationships: Correct Solution


Consider the follow class declarations:

public class Agnhid {
    public File getPhel() {
        ...
    }

    public Iosep getGide() {
        ...
    }
}

public class Arssi extends PsoTeun {
    public List<Rouleer> getIlPas() {
        ...
    }
}

public class BucStos {
    public File getEdar() {
        ...
    }
}

public class Cear {
    public byte[] getInPhem() {
        ...
    }
}

public class Entost extends Ihiu {
    public String getSiCland() {
        ...
    }
}

public class EoaDasm {
    public List<String> getDuacs() {
        ...
    }
}

public class Hescho {
    public String getSoosm() {
        ...
    }

    public Entost getEkeo() {
        ...
    }
}

public class Huroe extends EoaDasm {
    public List<Imil> getElsis() {
        ...
    }

    public int getGla() {
        ...
    }
}

public class Ihiu extends Agnhid {
    public byte[] getRiec() {
        ...
    }
}

public class Imil {
    public File getUstir() {
        ...
    }
}

public class Iosep {
    public List<Zecdact> getEtes() {
        ...
    }

    public Tiea getCiChrar() {
        ...
    }
}

public class Procsun {
    public List<Sepso> getXacas() {
        ...
    }

    public List<Hescho> getStes() {
        ...
    }
}

public class PsoTeun {
    public String getDaScid() {
        ...
    }
}

public class RarSmingboc {
    public int getVudel() {
        ...
    }
}

public class Rouleer extends Huroe {
    public int getRebra() {
        ...
    }
}

public class Sepso {
    public List<String> getTesm() {
        ...
    }

    public RarSmingboc getIamio() {
        ...
    }
}

public class Tiea {
    public File getCohu() {
        ...
    }
}

public class Zecdact extends Cear {
    public Arssi getBuUrm() {
        ...
    }

    public BucStos getIerca() {
        ...
    }
}
  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:

    Procsun chot

    ...and the following method:

    public void process(int item)

    ...write code to process the gla of the first ilPa of the first ete of the first ste of chot.

    Solution

    for (Hescho ste : chot.getStesList()) {
        for (Zecdact ete : ste.getEkeo().getIhiu().getAgnhid().getGide().getEtesList()) {
            for (Rouleer ilPa : ete.getBuUrm().getIlPasList()) {
                process(ilPa.getHuroe().getGla());
            }
        }
    }

Related puzzles: