Class relationships: Correct Solution


Consider the follow class declarations:

public class Auwo {
    public byte[] getSeSisma() {
        ...
    }
}

public class Edos {
    public File getChrel() {
        ...
    }
}

public class Fung {
    public byte[] getOcu() {
        ...
    }
}

public class Icmork {
    public List<Retiond> getPeIls() {
        ...
    }

    public String getAflia() {
        ...
    }
}

public class Idtwel {
    public Icmork getBumo() {
        ...
    }

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

public class Picsa extends PriAstrhang {
    public File getCoce() {
        ...
    }
}

public class Prantha {
    public List<Thimeut> getErOsses() {
        ...
    }

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

public class PriAstrhang {
    public int getLamal() {
        ...
    }
}

public class Retiond {
    public List<Travil> getTrats() {
        ...
    }

    public List<Fung> getIgrils() {
        ...
    }

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

public class Rhongtrest {
    public int getZios() {
        ...
    }

    public Thillvan getGaAhant() {
        ...
    }
}

public class Tathhan extends Prantha {
    public String getEnElth() {
        ...
    }
}

public class Thillvan extends Picsa {
    public List<Tathhan> getDaSpes() {
        ...
    }

    public Edos getCou() {
        ...
    }
}

public class Thimeut extends Idtwel {
    public int getAco() {
        ...
    }
}

public class Travil {
    public Auwo getBeGe() {
        ...
    }

    public String getGlesm() {
        ...
    }
}
  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:

    Rhongtrest mucs

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the piCowi of the first peIl of the first erOss of the first daSpe of mucs.

    Solution

    for (Tathhan daSpe : mucs.getGaAhant().getDaSpesList()) {
        for (Thimeut erOss : daSpe.getPrantha().getErOssesList()) {
            for (Retiond peIl : erOss.getIdtwel().getBumo().getPeIlsList()) {
                process(peIl.getPiCowi());
            }
        }
    }

Related puzzles: