Class relationships: Correct Solution


Consider the follow class declarations:

public class BirEung {
    public Urpral getIcTusvi() {
        ...
    }

    public int getIwsos() {
        ...
    }
}

public class Iunism extends Nuck {
    public byte[] getHec() {
        ...
    }
}

public class Iwoi extends Vumi {
    public Stretec getIlGamis() {
        ...
    }

    public Mesing getRac() {
        ...
    }
}

public class Keche {
    public List<VedNal> getScras() {
        ...
    }

    public List<MicThi> getFoUdceses() {
        ...
    }
}

public class Mesing {
    public List<PecKeced> getCiOts() {
        ...
    }

    public File getFri() {
        ...
    }
}

public class MicThi extends Xont {
    public Iunism getEdEi() {
        ...
    }
}

public class Nuck extends OruOong {
    public List<Pinbes> getPruils() {
        ...
    }
}

public class Nurs {
    public List<Plest> getVuFiases() {
        ...
    }

    public Iwoi getIsCeo() {
        ...
    }
}

public class OruOong {
    public File getEpeek() {
        ...
    }
}

public class PecKeced extends BirEung {
    public int getProna() {
        ...
    }

    public String getCexho() {
        ...
    }
}

public class Phaxgil extends Keche {
    public Pricuang getLiMunru() {
        ...
    }
}

public class Pinbes {
    public byte[] getEdem() {
        ...
    }

    public List<Sahu> getArNas() {
        ...
    }
}

public class Plest {
    public int getIrWirt() {
        ...
    }

    public List<UctPeulpro> getOcvans() {
        ...
    }
}

public class Pricuang {
    public byte[] getNas() {
        ...
    }
}

public class Psiss {
    public Phaxgil getPamid() {
        ...
    }

    public int getJis() {
        ...
    }
}

public class Sahu extends Nurs {
    public File getQiast() {
        ...
    }
}

public class Stretec {
    public int getAnGe() {
        ...
    }
}

public class UctPeulpro {
    public String getMusne() {
        ...
    }
}

public class Urpral {
    public byte[] getPsiar() {
        ...
    }
}

public class VedNal {
    public int getRar() {
        ...
    }
}

public class Vumi {
    public List<String> getHar() {
        ...
    }
}

public class Xont {
    public File getAnpal() {
        ...
    }
}
  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:

    Psiss oed

    ...and the following method:

    public void process(String item)

    ...write code to process the cexho of the first ciOt of each arNa of the first pruil of each foUdces of oed.

    Solution

    for (Pinbes pruil : oed.getPamid().getKeche().getFoUdceses().get(0).getEdEi().getNuck().getPruilsList()) {
        for (PecKeced ciOt : pruil.getArNas().get(0).getNurs().getIsCeo().getRac().getCiOtsList()) {
            process(ciOt.getCexho());
        }
    }

Related puzzles: