Class relationships: Correct Solution


Consider the follow class declarations:

public class Celspun extends Pren {
    public Todri getRado() {
        ...
    }
}

public class Chosmoor {
    public File getAbrou() {
        ...
    }
}

public class Cije {
    public File getMaqip() {
        ...
    }
}

public class Cilaum {
    public List<String> getGaIsted() {
        ...
    }
}

public class Crefou {
    public int getCeSu() {
        ...
    }
}

public class Crubri {
    public File getOul() {
        ...
    }
}

public class Gretad extends Trengeff {
    public List<String> getIssce() {
        ...
    }
}

public class Hidca {
    public String getOssid() {
        ...
    }
}

public class Inung {
    public List<String> getMisam() {
        ...
    }

    public int getKec() {
        ...
    }
}

public class IsaLirism extends Crubri {
    public List<Gretad> getDouns() {
        ...
    }
}

public class Lepriss {
    public List<Wabee> getTePides() {
        ...
    }

    public List<Chosmoor> getEePhods() {
        ...
    }
}

public class MiiTiprir extends Slontra {
    public List<Crefou> getNals() {
        ...
    }

    public Hidca getLenom() {
        ...
    }

    public IsaLirism getAol() {
        ...
    }
}

public class Narmhi {
    public List<String> getPicri() {
        ...
    }

    public MiiTiprir getScia() {
        ...
    }
}

public class Nofiass extends Lepriss {
    public Cilaum getHesh() {
        ...
    }
}

public class Pren {
    public int getMusis() {
        ...
    }

    public List<Narmhi> getChreus() {
        ...
    }
}

public class Sest {
    public List<Cije> getNels() {
        ...
    }

    public String getHiass() {
        ...
    }
}

public class Slontra {
    public int getExvoc() {
        ...
    }
}

public class Todri {
    public String getBaes() {
        ...
    }
}

public class Trengeff {
    public Inung getOvon() {
        ...
    }

    public List<Sest> getVapsos() {
        ...
    }
}

public class Wabee {
    public byte[] getUiner() {
        ...
    }

    public Celspun getNisde() {
        ...
    }
}
  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:

    Nofiass wil

    ...and the following method:

    public void process(int item)

    ...write code to process the kec of the first doun of the first chreu of each tePide of wil.

    Solution

    for (Narmhi chreu : wil.getLepriss().getTePides().get(0).getNisde().getPren().getChreusList()) {
        for (Gretad doun : chreu.getScia().getAol().getDounsList()) {
            process(doun.getTrengeff().getOvon().getKec());
        }
    }

Related puzzles: