Class relationships: Correct Solution


Consider the follow class declarations:

public class Cladan {
    public List<PraRamcoes> getNosts() {
        ...
    }

    public File getElun() {
        ...
    }
}

public class DaiMinler {
    public List<String> getVinte() {
        ...
    }
}

public class Groc extends Cladan {
    public Pesesh getGorad() {
        ...
    }

    public List<Veno> getRors() {
        ...
    }
}

public class Mecad extends NinBramniack {
    public Groc getRou() {
        ...
    }
}

public class NinBramniack {
    public byte[] getSosa() {
        ...
    }
}

public class Pesesh {
    public int getQasde() {
        ...
    }
}

public class PraRamcoes {
    public byte[] getJoSarn() {
        ...
    }

    public String getSiLo() {
        ...
    }
}

public class Teeda {
    public DaiMinler getMaci() {
        ...
    }

    public List<Veclou> getEaPrels() {
        ...
    }
}

public class Veclou extends Mecad {
    public File getRasi() {
        ...
    }
}

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

    Teeda i

    ...and the following method:

    public void process(String item)

    ...write code to process the siLo of the first nost of each eaPrel of i.

    Solution

    for (PraRamcoes nost : i.getEaPrels().get(0).getMecad().getRou().getCladan().getNostsList()) {
        process(nost.getSiLo());
    }

Related puzzles: