Class relationships: Correct Solution


Consider the follow class declarations:

public class Acoo {
    public byte[] getSnad() {
        ...
    }

    public Swiched getSpo() {
        ...
    }
}

public class Chialhoa {
    public Nasm getIdWirre() {
        ...
    }

    public File getOapor() {
        ...
    }
}

public class Chistnior {
    public List<Chialhoa> getNics() {
        ...
    }

    public List<Ocirk> getWoins() {
        ...
    }
}

public class Cioll {
    public File getOuss() {
        ...
    }
}

public class Dest {
    public int getJand() {
        ...
    }
}

public class Epttes extends Chistnior {
    public byte[] getPeOerad() {
        ...
    }
}

public class Hiese extends Ioest {
    public Rethjir getMur() {
        ...
    }

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

public class Ioest {
    public File getOltu() {
        ...
    }
}

public class Nasm {
    public String getEsac() {
        ...
    }
}

public class Ocirk {
    public List<Dest> getAdSas() {
        ...
    }

    public List<Cioll> getIins() {
        ...
    }

    public Pupror getEur() {
        ...
    }
}

public class Pruer extends Acoo {
    public File getOsbu() {
        ...
    }
}

public class Pupror {
    public int getBente() {
        ...
    }

    public Hiese getCim() {
        ...
    }
}

public class Rethjir {
    public byte[] getLaNesa() {
        ...
    }
}

public class Swiched {
    public List<Epttes> getEdGasas() {
        ...
    }

    public String getLuler() {
        ...
    }
}
  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:

    Pruer i

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the spibo of the first woin of each edGasa of i.

    Solution

    for (Ocirk woin : i.getAcoo().getSpo().getEdGasas().get(0).getChistnior().getWoinsList()) {
        process(woin.getEur().getCim().getSpibo());
    }

Related puzzles: