Class relationships: Correct Solution


Consider the follow class declarations:

public class Antsclec {
    public int getHiSo() {
        ...
    }

    public List<Chradspond> getRatras() {
        ...
    }
}

public class Avas {
    public List<String> getCeual() {
        ...
    }

    public PioNian getPrun() {
        ...
    }
}

public class Chradspond extends Soct {
    public Clutgeae getIoGred() {
        ...
    }
}

public class Clutgeae {
    public byte[] getHoHord() {
        ...
    }
}

public class Eccan {
    public File getPeOlpid() {
        ...
    }

    public int getSmec() {
        ...
    }
}

public class Emio extends VenOntboss {
    public Esssoo getSted() {
        ...
    }
}

public class Esssoo {
    public List<String> getEbo() {
        ...
    }
}

public class PioNian extends Zaen {
    public List<Pistkiss> getSadpos() {
        ...
    }

    public List<Emio> getDondes() {
        ...
    }
}

public class Pistkiss {
    public int getPoum() {
        ...
    }
}

public class Presgrioc {
    public byte[] getEeoss() {
        ...
    }
}

public class Sansthoss {
    public int getOble() {
        ...
    }
}

public class Soct {
    public List<Eccan> getCoRedirs() {
        ...
    }

    public Presgrioc getLenli() {
        ...
    }
}

public class VenOntboss extends Sansthoss {
    public Antsclec getCison() {
        ...
    }
}

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

    Avas is

    ...and the following method:

    public void process(int item)

    ...write code to process the smec of the first coRedir of each ratra of each donde of is.

    Solution

    for (Eccan coRedir : is.getPrun().getDondes().get(0).getVenOntboss().getCison().getRatras().get(0).getSoct().getCoRedirsList()) {
        process(coRedir.getSmec());
    }

Related puzzles: