Class relationships: Correct Solution


Consider the follow class declarations:

public class Anlaint {
    public int getSli() {
        ...
    }
}

public class Biass {
    public String getPiAtoa() {
        ...
    }
}

public class Cantjac {
    public byte[] getArOmi() {
        ...
    }

    public int getEdwon() {
        ...
    }
}

public class Cesang extends Biass {
    public Iocpec getCoi() {
        ...
    }
}

public class Ciadto {
    public List<Foubae> getPrulks() {
        ...
    }

    public File getFaset() {
        ...
    }
}

public class Ecji extends Phace {
    public List<Ciadto> getBils() {
        ...
    }

    public Tulio getTenin() {
        ...
    }
}

public class Foubae {
    public File getCang() {
        ...
    }
}

public class Grostoc {
    public String getOucoo() {
        ...
    }

    public List<Cantjac> getNels() {
        ...
    }
}

public class Iocpec extends Grostoc {
    public String getNeRe() {
        ...
    }
}

public class Phace {
    public List<Cesang> getTados() {
        ...
    }

    public Anlaint getRamad() {
        ...
    }
}

public class Puhpes {
    public byte[] getMeeng() {
        ...
    }

    public Ecji getDeshe() {
        ...
    }
}

public class Tulio {
    public int getPlad() {
        ...
    }
}
  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:

    Puhpes le

    ...and the following method:

    public void process(int item)

    ...write code to process the edwon of each nel of the first tado of le.

    Solution

    for (Cesang tado : le.getDeshe().getPhace().getTadosList()) {
        process(tado.getCoi().getGrostoc().getNels().get(0).getEdwon());
    }

Related puzzles: