Class relationships: Correct Solution


Consider the follow class declarations:

public class Ahgent {
    public Resmletch getScid() {
        ...
    }

    public int getXied() {
        ...
    }
}

public class Ailgro extends CacMionor {
    public String getRePak() {
        ...
    }
}

public class Bignunt {
    public File getItSas() {
        ...
    }
}

public class Birtstiss {
    public int getEcCo() {
        ...
    }
}

public class Brentmi {
    public byte[] getNanol() {
        ...
    }

    public Ordirm getErm() {
        ...
    }
}

public class CacMionor {
    public List<Phisme> getImkuds() {
        ...
    }

    public Vufint getPhoph() {
        ...
    }
}

public class CecUsco {
    public List<String> getEchi() {
        ...
    }
}

public class Dianch {
    public Flunxash getErOl() {
        ...
    }

    public File getPaVador() {
        ...
    }
}

public class Flackee extends Naschism {
    public Bignunt getAtPris() {
        ...
    }

    public byte[] getSpinu() {
        ...
    }
}

public class Flidpud {
    public int getSkist() {
        ...
    }
}

public class Flunxash extends Ahgent {
    public File getLaba() {
        ...
    }
}

public class Grochis extends Brentmi {
    public byte[] getImall() {
        ...
    }
}

public class Hassde {
    public byte[] getSqo() {
        ...
    }
}

public class Hingpo {
    public List<Grochis> getRiIses() {
        ...
    }

    public Midci getPring() {
        ...
    }
}

public class Midci {
    public String getCiPri() {
        ...
    }
}

public class Naschism {
    public int getCes() {
        ...
    }
}

public class Noshad {
    public String getToDed() {
        ...
    }
}

public class OorGlond {
    public List<String> getAuVo() {
        ...
    }
}

public class Ordirm extends Salu {
    public int getDeScres() {
        ...
    }
}

public class Phisme extends Flidpud {
    public Hingpo getSeEdi() {
        ...
    }
}

public class Resmletch {
    public List<Flackee> getFuises() {
        ...
    }

    public List<Wisschrac> getGrus() {
        ...
    }
}

public class Salu {
    public List<Hassde> getRirs() {
        ...
    }

    public List<Dianch> getDepus() {
        ...
    }
}

public class Vufint extends Birtstiss {
    public List<CecUsco> getOnAocs() {
        ...
    }

    public List<OorGlond> getOngas() {
        ...
    }
}

public class Wisschrac {
    public Noshad getSphui() {
        ...
    }

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

    Ailgro vess

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the spinu of the first fuis of the first depu of each riIs of each imkud of vess.

    Solution

    for (Dianch depu : vess.getCacMionor().getImkuds().get(0).getSeEdi().getRiIses().get(0).getBrentmi().getErm().getSalu().getDepusList()) {
        for (Flackee fuis : depu.getErOl().getAhgent().getScid().getFuisesList()) {
            process(fuis.getSpinu());
        }
    }

Related puzzles: