Class relationships: Correct Solution


Consider the follow class declarations:

public class Asche {
    public File getCeen() {
        ...
    }

    public Didpe getRis() {
        ...
    }
}

public class BiaSni {
    public byte[] getOdRodma() {
        ...
    }
}

public class Cinas extends Osol {
    public String getElGism() {
        ...
    }
}

public class Congel {
    public List<Cinas> getCiAunous() {
        ...
    }

    public Wistho getIod() {
        ...
    }
}

public class Cossmic {
    public byte[] getIcoss() {
        ...
    }

    public Idcong getIplio() {
        ...
    }
}

public class Didpe extends Haunschusm {
    public List<Pism> getBres() {
        ...
    }
}

public class Gowos {
    public byte[] getPlihi() {
        ...
    }
}

public class Haunschusm extends Lito {
    public BiaSni getWel() {
        ...
    }
}

public class Idcong {
    public List<Praispa> getOihals() {
        ...
    }

    public int getAdJemn() {
        ...
    }
}

public class Lito extends Thicble {
    public List<Prian> getUahis() {
        ...
    }
}

public class Osol {
    public int getLaIol() {
        ...
    }
}

public class Pirna extends Cossmic {
    public int getTaMuen() {
        ...
    }
}

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

public class Praispa {
    public List<Congel> getUdsios() {
        ...
    }

    public List<Asche> getGimas() {
        ...
    }
}

public class Prian {
    public Gowos getCes() {
        ...
    }

    public UsoHaecrho getHilpa() {
        ...
    }
}

public class Thicble {
    public File getIspui() {
        ...
    }
}

public class UsoHaecrho {
    public List<String> getIer() {
        ...
    }

    public int getCios() {
        ...
    }
}

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

    Pirna mial

    ...and the following method:

    public void process(int item)

    ...write code to process the cios of the first uahi of each gima of each oihal of mial.

    Solution

    for (Prian uahi : mial.getCossmic().getIplio().getOihals().get(0).getGimas().get(0).getRis().getHaunschusm().getLito().getUahisList()) {
        process(uahi.getHilpa().getCios());
    }

Related puzzles: