Class relationships: Correct Solution


Consider the follow class declarations:

public class Ceangsol extends Utpo {
    public int getFunni() {
        ...
    }
}

public class Cinfa {
    public String getPrass() {
        ...
    }
}

public class Feir {
    public byte[] getIrEa() {
        ...
    }
}

public class Glerd extends Cinfa {
    public List<Ceangsol> getSaghts() {
        ...
    }

    public Feir getEdpar() {
        ...
    }
}

public class Mirpreouss {
    public byte[] getFla() {
        ...
    }
}

public class Neiclor {
    public String getPihil() {
        ...
    }

    public List<PocKniserp> getIeSces() {
        ...
    }
}

public class PocKniserp {
    public List<Mirpreouss> getEdLardis() {
        ...
    }

    public int getPliod() {
        ...
    }

    public String getVism() {
        ...
    }
}

public class Sint {
    public int getMeRac() {
        ...
    }
}

public class Utpo extends Neiclor {
    public File getSeReism() {
        ...
    }
}

public class Wacel {
    public Sint getBri() {
        ...
    }

    public Glerd getDapri() {
        ...
    }
}
  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:

    Wacel ce

    ...and the following method:

    public void process(String item)

    ...write code to process the vism of the first ieSce of the first saght of ce.

    Solution

    for (Ceangsol saght : ce.getDapri().getSaghtsList()) {
        for (PocKniserp ieSce : saght.getUtpo().getNeiclor().getIeScesList()) {
            process(ieSce.getVism());
        }
    }

Related puzzles: