Class relationships: Correct Solution


Consider the follow class declarations:

public class Ahop {
    public byte[] getTud() {
        ...
    }

    public List<Foriast> getErdos() {
        ...
    }
}

public class Cerk {
    public File getAskec() {
        ...
    }
}

public class Chri {
    public byte[] getUrwic() {
        ...
    }
}

public class Cind {
    public List<Pricfen> getPrers() {
        ...
    }

    public File getCheon() {
        ...
    }
}

public class Cokte extends EntLism {
    public List<String> getTeWre() {
        ...
    }
}

public class Edint extends Oisa {
    public File getBodfa() {
        ...
    }
}

public class EntLism {
    public Smemtra getAswu() {
        ...
    }

    public Cind getPuin() {
        ...
    }
}

public class Esspe {
    public List<String> getHuEngna() {
        ...
    }

    public Cokte getScu() {
        ...
    }
}

public class Foriast extends Issial {
    public byte[] getIght() {
        ...
    }
}

public class Hahod {
    public String getPioss() {
        ...
    }
}

public class Iost {
    public List<String> getAmBic() {
        ...
    }
}

public class Isgo {
    public List<Siacho> getDolos() {
        ...
    }

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

public class Issial extends Viprort {
    public int getLoah() {
        ...
    }
}

public class Lahat {
    public List<String> getDaFissa() {
        ...
    }
}

public class Oisa {
    public String getThu() {
        ...
    }
}

public class OndTrovor {
    public File getCirth() {
        ...
    }
}

public class Piass {
    public byte[] getUrm() {
        ...
    }
}

public class Pricfen {
    public Piass getAnCift() {
        ...
    }

    public List<Cerk> getImuns() {
        ...
    }

    public int getTuphe() {
        ...
    }
}

public class RilSojal extends Hahod {
    public File getVorn() {
        ...
    }
}

public class Siacho extends Spathrot {
    public List<OndTrovor> getFrauls() {
        ...
    }
}

public class Smemtra {
    public Lahat getMepre() {
        ...
    }

    public Iost getVaspi() {
        ...
    }
}

public class Spathrot {
    public Taec getNaal() {
        ...
    }

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

public class Taec {
    public int getStus() {
        ...
    }

    public Ahop getFaa() {
        ...
    }
}

public class Viprort {
    public Chri getProul() {
        ...
    }

    public List<Edint> getTrirts() {
        ...
    }

    public List<RilSojal> getIaSiasts() {
        ...
    }

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

    Isgo ho

    ...and the following method:

    public void process(int item)

    ...write code to process the tuphe of each prer of the first muBi of the first erdo of the first dolo of ho.

    Solution

    for (Siacho dolo : ho.getDolosList()) {
        for (Foriast erdo : dolo.getSpathrot().getNaal().getFaa().getErdosList()) {
            for (Esspe muBi : erdo.getIssial().getViprort().getMuBisList()) {
                process(muBi.getScu().getEntLism().getPuin().getPrers().get(0).getTuphe());
            }
        }
    }

Related puzzles: