Class relationships: Correct Solution


Consider the follow class declarations:

public class AthCasuish {
    public int getPentu() {
        ...
    }
}

public class Chaal {
    public List<Pruanpha> getIumets() {
        ...
    }

    public List<Slen> getUrreses() {
        ...
    }

    public List<Scraeld> getMuIrs() {
        ...
    }
}

public class Cutgo {
    public File getJeWi() {
        ...
    }
}

public class Diamp {
    public Peja getSuir() {
        ...
    }

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

public class Doocs {
    public File getDiost() {
        ...
    }

    public Usspon getJarpe() {
        ...
    }
}

public class Eciss {
    public Chaal getPaen() {
        ...
    }

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

public class Egle extends Zistrid {
    public Stro getOsIs() {
        ...
    }
}

public class Engho extends Diamp {
    public List<Rirch> getVuhils() {
        ...
    }
}

public class Esdir {
    public List<String> getOlEr() {
        ...
    }

    public Ransmac getImEnreu() {
        ...
    }
}

public class Essprent {
    public List<String> getRecar() {
        ...
    }

    public List<AthCasuish> getStoors() {
        ...
    }
}

public class Mirdga {
    public List<Doocs> getDrals() {
        ...
    }

    public Prusslach getHupac() {
        ...
    }

    public Essprent getClost() {
        ...
    }
}

public class Nader {
    public String getBisa() {
        ...
    }
}

public class Peja {
    public List<String> getPrel() {
        ...
    }
}

public class Phentsqul {
    public File getInsce() {
        ...
    }
}

public class Pruanpha extends Mirdga {
    public List<Phentsqul> getOsses() {
        ...
    }
}

public class Prusslach {
    public List<String> getCui() {
        ...
    }
}

public class Ransmac extends Engho {
    public byte[] getCin() {
        ...
    }
}

public class Rirch extends Tedlel {
    public byte[] getCoshi() {
        ...
    }
}

public class Scraeld {
    public String getQeill() {
        ...
    }
}

public class Slen {
    public byte[] getIss() {
        ...
    }
}

public class Stro extends Eciss {
    public List<String> getSti() {
        ...
    }
}

public class Tedlel extends Nader {
    public List<Egle> getFaVis() {
        ...
    }
}

public class Usspon {
    public Cutgo getOrten() {
        ...
    }

    public String getCless() {
        ...
    }

    public int getTeour() {
        ...
    }
}

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

    Esdir elor

    ...and the following method:

    public void process(int item)

    ...write code to process the teour of each dral of the first iumet of the first faVi of the first vuhil of elor.

    Solution

    for (Rirch vuhil : elor.getImEnreu().getEngho().getVuhilsList()) {
        for (Egle faVi : vuhil.getTedlel().getFaVisList()) {
            for (Pruanpha iumet : faVi.getOsIs().getEciss().getPaen().getIumetsList()) {
                process(iumet.getMirdga().getDrals().get(0).getJarpe().getTeour());
            }
        }
    }

Related puzzles: