Class relationships: Correct Solution


Consider the follow class declarations:

public class AaePenor {
    public String getPha() {
        ...
    }

    public Turis getSpoi() {
        ...
    }

    public int getAnPa() {
        ...
    }
}

public class Cohe {
    public File getDuhis() {
        ...
    }
}

public class Cramur {
    public Rinre getCeIlung() {
        ...
    }

    public int getLoer() {
        ...
    }
}

public class Fifa {
    public List<String> getMaKesm() {
        ...
    }
}

public class Fion extends Lumac {
    public List<String> getHetou() {
        ...
    }
}

public class Fucen {
    public List<Gischou> getBeus() {
        ...
    }

    public List<XinSpesse> getHepis() {
        ...
    }
}

public class Gischou {
    public UonCemi getItpor() {
        ...
    }

    public String getIac() {
        ...
    }
}

public class Lumac {
    public List<Cramur> getFoKapios() {
        ...
    }

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

public class Luss extends NerGerds {
    public byte[] getChong() {
        ...
    }
}

public class NerGerds {
    public List<Fion> getHeUsses() {
        ...
    }

    public Rasto getBiust() {
        ...
    }
}

public class Onsept {
    public Rothou getMoool() {
        ...
    }

    public String getSont() {
        ...
    }
}

public class Pewhen {
    public List<String> getBalbi() {
        ...
    }
}

public class Rasto extends Cohe {
    public int getDeng() {
        ...
    }
}

public class Rinre extends AaePenor {
    public List<Tadird> getEeRirms() {
        ...
    }
}

public class Rothou {
    public File getQorio() {
        ...
    }
}

public class Tadird extends Pewhen {
    public List<String> getPri() {
        ...
    }
}

public class Turis {
    public File getChahu() {
        ...
    }

    public List<Onsept> getSobums() {
        ...
    }
}

public class UonCemi extends WoiKle {
    public String getBorto() {
        ...
    }
}

public class WoiKle extends Fifa {
    public Luss getPePusgu() {
        ...
    }
}

public class XinSpesse {
    public byte[] getOmDi() {
        ...
    }
}
  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:

    Fucen nouo

    ...and the following method:

    public void process(int item)

    ...write code to process the anPa of each foKapio of each heUss of the first beu of nouo.

    Solution

    for (Gischou beu : nouo.getBeusList()) {
        process(beu.getItpor().getWoiKle().getPePusgu().getNerGerds().getHeUsses().get(0).getLumac().getFoKapios().get(0).getCeIlung().getAaePenor().getAnPa());
    }

Related puzzles: