Class relationships: Correct Solution


Consider the follow class declarations:

public class Acbas {
    public List<String> getRird() {
        ...
    }

    public List<Nioss> getBinmis() {
        ...
    }
}

public class Bengba {
    public Stocangs getPoSnel() {
        ...
    }

    public String getOmasm() {
        ...
    }
}

public class Blep {
    public List<String> getIdSpim() {
        ...
    }

    public String getNelir() {
        ...
    }
}

public class Bufrod {
    public byte[] getUprir() {
        ...
    }
}

public class CasOdsqe {
    public int getCicfa() {
        ...
    }
}

public class Dange {
    public List<Igesm> getRirals() {
        ...
    }

    public CasOdsqe getSwesm() {
        ...
    }
}

public class Desden {
    public String getAng() {
        ...
    }
}

public class Dinfled extends Bufrod {
    public List<Blep> getScocs() {
        ...
    }
}

public class Erdin extends Dange {
    public List<String> getCus() {
        ...
    }
}

public class Glun {
    public byte[] getCeSluc() {
        ...
    }
}

public class Igesm extends Desden {
    public Tengosm getCriar() {
        ...
    }
}

public class Moitan {
    public byte[] getPni() {
        ...
    }
}

public class Nioss extends Dinfled {
    public List<Moitan> getCarms() {
        ...
    }
}

public class Ojan {
    public String getQol() {
        ...
    }
}

public class Olon {
    public byte[] getDazo() {
        ...
    }
}

public class Qint {
    public byte[] getMork() {
        ...
    }
}

public class Stocangs extends Erdin {
    public Twon getElo() {
        ...
    }
}

public class Tengosm {
    public Glun getEmas() {
        ...
    }

    public Acbas getSpi() {
        ...
    }

    public List<Olon> getEnlises() {
        ...
    }
}

public class Twon extends Ojan {
    public byte[] getCrod() {
        ...
    }
}

public class Xeffma {
    public List<Bengba> getIcis() {
        ...
    }

    public List<Qint> getAads() {
        ...
    }
}
  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:

    Xeffma on

    ...and the following method:

    public void process(String item)

    ...write code to process the nelir of the first scoc of each binmi of the first riral of each ici of on.

    Solution

    for (Igesm riral : on.getIcis().get(0).getPoSnel().getErdin().getDange().getRiralsList()) {
        for (Blep scoc : riral.getCriar().getSpi().getBinmis().get(0).getDinfled().getScocsList()) {
            process(scoc.getNelir());
        }
    }

Related puzzles: