Class relationships: Correct Solution


Consider the follow class declarations:

public class Bahe {
    public List<Ungsu> getLoseas() {
        ...
    }

    public File getLiHu() {
        ...
    }
}

public class Ceplioul extends Spibra {
    public byte[] getOdbre() {
        ...
    }
}

public class Eear {
    public List<String> getOrMoik() {
        ...
    }

    public String getOus() {
        ...
    }
}

public class Noslis {
    public byte[] getClil() {
        ...
    }
}

public class Prar {
    public File getPren() {
        ...
    }
}

public class Prested extends Sest {
    public Psoc getVero() {
        ...
    }
}

public class Psoc extends Tasfluc {
    public String getStal() {
        ...
    }
}

public class PuiPentmat extends Rantti {
    public byte[] getDaBerd() {
        ...
    }
}

public class Rantti {
    public Ceplioul getDontu() {
        ...
    }

    public List<Bahe> getNiols() {
        ...
    }
}

public class Sapmist {
    public List<Prar> getCecs() {
        ...
    }

    public File getOsa() {
        ...
    }
}

public class Sest {
    public int getHar() {
        ...
    }

    public List<Truil> getGords() {
        ...
    }
}

public class Siaca {
    public byte[] getDus() {
        ...
    }
}

public class Spibra {
    public Trinnint getMec() {
        ...
    }

    public String getPseel() {
        ...
    }
}

public class Tasfluc {
    public byte[] getAnMiph() {
        ...
    }
}

public class Therphur extends Siaca {
    public Sapmist getDePreo() {
        ...
    }

    public List<PuiPentmat> getTrixes() {
        ...
    }
}

public class Trinnint {
    public byte[] getItKongi() {
        ...
    }

    public List<Prested> getChiuses() {
        ...
    }
}

public class Truil extends Noslis {
    public Eear getRogdi() {
        ...
    }
}

public class Ungsu {
    public int getDrass() {
        ...
    }
}
  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:

    Therphur rer

    ...and the following method:

    public void process(String item)

    ...write code to process the ous of each gord of the first chius of the first trixe of rer.

    Solution

    for (PuiPentmat trixe : rer.getTrixesList()) {
        for (Prested chius : trixe.getRantti().getDontu().getSpibra().getMec().getChiusesList()) {
            process(chius.getSest().getGords().get(0).getRogdi().getOus());
        }
    }

Related puzzles: