Class relationships: Correct Solution


Consider the follow class declarations:

public class Chantsas {
    public String getIoar() {
        ...
    }
}

public class Cufri {
    public byte[] getErrod() {
        ...
    }
}

public class ErtPestke {
    public String getUsCinil() {
        ...
    }
}

public class Essma {
    public String getCoHua() {
        ...
    }
}

public class Iiss {
    public List<Toingu> getGousms() {
        ...
    }

    public List<String> getEdap() {
        ...
    }
}

public class JeiArphes extends ErtPestke {
    public Chantsas getPhur() {
        ...
    }

    public List<Iiss> getPodkis() {
        ...
    }

    public List<Patib> getBiadis() {
        ...
    }
}

public class Lacir {
    public byte[] getCetor() {
        ...
    }

    public Puhel getTeFoull() {
        ...
    }
}

public class Ople {
    public File getBelke() {
        ...
    }

    public Xomhe getInua() {
        ...
    }
}

public class Patib extends Ople {
    public Cufri getHees() {
        ...
    }
}

public class Prongchrun {
    public String getSosm() {
        ...
    }

    public String getCuard() {
        ...
    }
}

public class Puhel {
    public Prongchrun getRooa() {
        ...
    }

    public List<String> getDuil() {
        ...
    }
}

public class Qunvess extends Lacir {
    public byte[] getToCosar() {
        ...
    }
}

public class Toingu {
    public byte[] getLienk() {
        ...
    }
}

public class Xomhe {
    public List<Essma> getTaPerels() {
        ...
    }

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

    JeiArphes gno

    ...and the following method:

    public void process(String item)

    ...write code to process the cuard of the first pou of the first biadi of gno.

    Solution

    for (Patib biadi : gno.getBiadisList()) {
        for (Qunvess pou : biadi.getOple().getInua().getPousList()) {
            process(pou.getLacir().getTeFoull().getRooa().getCuard());
        }
    }

Related puzzles: