Class relationships: Correct Solution


Consider the follow class declarations:

public class CelMaglel {
    public List<Miha> getVafels() {
        ...
    }

    public File getAsi() {
        ...
    }
}

public class Ceusm {
    public Poupe getNePuc() {
        ...
    }

    public List<Thec> getWasses() {
        ...
    }
}

public class CilCuia {
    public List<String> getAsean() {
        ...
    }
}

public class Datei {
    public Ospro getSanic() {
        ...
    }

    public File getIss() {
        ...
    }
}

public class Doad {
    public byte[] getEcPiroc() {
        ...
    }

    public String getMiCo() {
        ...
    }
}

public class Fudces {
    public byte[] getRhu() {
        ...
    }
}

public class Micoing {
    public int getReir() {
        ...
    }
}

public class Miha {
    public String getPlo() {
        ...
    }

    public Datei getOtCism() {
        ...
    }
}

public class Nenish {
    public int getLom() {
        ...
    }
}

public class Nurnmo extends Fudces {
    public File getEac() {
        ...
    }
}

public class Ospro extends Splanciapt {
    public int getIsFli() {
        ...
    }
}

public class Poupe extends CilCuia {
    public List<Taerce> getQoPios() {
        ...
    }

    public List<Micoing> getCehins() {
        ...
    }
}

public class Qesm {
    public List<String> getBrur() {
        ...
    }

    public List<Uenden> getAfas() {
        ...
    }
}

public class Rariur extends Telma {
    public List<Nenish> getBaCins() {
        ...
    }
}

public class Roodan {
    public String getThrim() {
        ...
    }
}

public class Sasster {
    public List<String> getAchil() {
        ...
    }
}

public class Splanciapt {
    public List<String> getHavo() {
        ...
    }

    public List<Rariur> getNins() {
        ...
    }
}

public class Taerce extends Doad {
    public Roodan getGucra() {
        ...
    }
}

public class Telma {
    public Nurnmo getWelul() {
        ...
    }

    public List<Ceusm> getAtus() {
        ...
    }
}

public class Thec {
    public List<String> getLiQapap() {
        ...
    }
}

public class Thra extends CelMaglel {
    public Sasster getScin() {
        ...
    }

    public Qesm getRal() {
        ...
    }
}

public class Uenden {
    public File getIdIl() {
        ...
    }
}
  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:

    Thra mirt

    ...and the following method:

    public void process(String item)

    ...write code to process the miCo of the first qoPio of the first atu of the first nin of each vafel of mirt.

    Solution

    for (Rariur nin : mirt.getCelMaglel().getVafels().get(0).getOtCism().getSanic().getSplanciapt().getNinsList()) {
        for (Ceusm atu : nin.getTelma().getAtusList()) {
            for (Taerce qoPio : atu.getNePuc().getQoPiosList()) {
                process(qoPio.getDoad().getMiCo());
            }
        }
    }

Related puzzles: