Class relationships: Correct Solution


Consider the follow class declarations:

public class Acsou {
    public String getEnt() {
        ...
    }
}

public class Aunent {
    public String getWher() {
        ...
    }
}

public class Cedleon {
    public String getSpu() {
        ...
    }

    public Earm getSiIl() {
        ...
    }
}

public class Eaerchi extends Vorpe {
    public Russoec getCiGri() {
        ...
    }
}

public class Earm {
    public List<Aunent> getEcCes() {
        ...
    }

    public File getCaPabai() {
        ...
    }

    public int getMeIn() {
        ...
    }
}

public class Imtoar {
    public File getInec() {
        ...
    }
}

public class Phihau extends Acsou {
    public Eaerchi getNau() {
        ...
    }
}

public class Russoec {
    public byte[] getBiSeng() {
        ...
    }
}

public class Velven extends Imtoar {
    public List<Phihau> getOcIas() {
        ...
    }
}

public class Vorpe {
    public List<Cedleon> getSarns() {
        ...
    }

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

    Velven toep

    ...and the following method:

    public void process(int item)

    ...write code to process the meIn of the first sarn of the first ocIa of toep.

    Solution

    for (Phihau ocIa : toep.getOcIasList()) {
        for (Cedleon sarn : ocIa.getNau().getVorpe().getSarnsList()) {
            process(sarn.getSiIl().getMeIn());
        }
    }

Related puzzles: