Class relationships: Correct Solution


Consider the follow class declarations:

public class DriFritiss {
    public int getWesa() {
        ...
    }
}

public class Erparm {
    public byte[] getOadmi() {
        ...
    }
}

public class Fror {
    public Trou getVarf() {
        ...
    }

    public List<Erparm> getPuTuses() {
        ...
    }
}

public class Hini {
    public List<String> getAeMelad() {
        ...
    }
}

public class Hokris extends Nanduass {
    public Mour getIaMi() {
        ...
    }
}

public class Lilpua extends Hini {
    public List<Hokris> getRaEstdas() {
        ...
    }
}

public class Mour extends DriFritiss {
    public List<String> getErAsm() {
        ...
    }
}

public class Nanduass {
    public Viod getAdac() {
        ...
    }

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

public class OshHirt extends Pneonta {
    public File getDeAn() {
        ...
    }
}

public class Pneonta {
    public List<String> getPoes() {
        ...
    }
}

public class Sphec {
    public Lilpua getBiOun() {
        ...
    }

    public File getRou() {
        ...
    }
}

public class Trou {
    public List<OshHirt> getErts() {
        ...
    }

    public List<Vosm> getIrsases() {
        ...
    }
}

public class Viod {
    public File getVeblo() {
        ...
    }

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

public class Vosm extends Sphec {
    public File getGocku() {
        ...
    }
}
  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:

    Fror remo

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the rer of each raEstda of the first irsas of remo.

    Solution

    for (Vosm irsas : remo.getVarf().getIrsasesList()) {
        process(irsas.getSphec().getBiOun().getRaEstdas().get(0).getNanduass().getAdac().getRer());
    }

Related puzzles: