Class relationships: Correct Solution


Consider the follow class declarations:

public class Asra extends Bapseir {
    public Penthio getPec() {
        ...
    }
}

public class Asser extends Asra {
    public Sacdiol getToEhind() {
        ...
    }
}

public class Bapseir {
    public List<String> getKiwen() {
        ...
    }
}

public class Besent {
    public int getTeTomad() {
        ...
    }
}

public class Cioel {
    public File getLeUiro() {
        ...
    }
}

public class EemEckrer extends Pecge {
    public int getOsCae() {
        ...
    }
}

public class Halol {
    public byte[] getWher() {
        ...
    }
}

public class Heddes {
    public byte[] getIess() {
        ...
    }

    public List<Ropawn> getCoNos() {
        ...
    }
}

public class Jodsist extends Nasqerd {
    public byte[] getAdtod() {
        ...
    }
}

public class Moct {
    public String getMiPodce() {
        ...
    }
}

public class Nasqerd {
    public int getUss() {
        ...
    }

    public List<Asser> getAnCes() {
        ...
    }
}

public class Nestpud extends Shedcong {
    public File getCus() {
        ...
    }
}

public class Pecge {
    public List<String> getPaqo() {
        ...
    }

    public Moct getUaHooec() {
        ...
    }

    public List<String> getArCing() {
        ...
    }
}

public class Penthio extends Cioel {
    public List<Halol> getNies() {
        ...
    }

    public List<Besent> getDivocs() {
        ...
    }

    public List<Heddes> getCiBrosts() {
        ...
    }
}

public class Prili {
    public Jodsist getPevo() {
        ...
    }

    public List<Nestpud> getDubas() {
        ...
    }
}

public class Ropawn {
    public File getSte() {
        ...
    }

    public EemEckrer getWasm() {
        ...
    }
}

public class Sacdiol {
    public String getTru() {
        ...
    }
}

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

    Prili oal

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the arCing of the first coNo of the first ciBrost of the first anCe of oal.

    Solution

    for (Asser anCe : oal.getPevo().getNasqerd().getAnCesList()) {
        for (Heddes ciBrost : anCe.getAsra().getPec().getCiBrostsList()) {
            for (Ropawn coNo : ciBrost.getCoNosList()) {
                process(coNo.getWasm().getPecge().getArCing());
            }
        }
    }

Related puzzles: