Class relationships: Correct Solution


Consider the follow class declarations:

public class Aong {
    public int getBaAng() {
        ...
    }

    public int getIcWou() {
        ...
    }
}

public class Cerag extends Mectos {
    public List<Shuntcas> getZanks() {
        ...
    }
}

public class Craskshing extends Socau {
    public File getHoGa() {
        ...
    }
}

public class Flilhu {
    public byte[] getPla() {
        ...
    }
}

public class Grapeul extends Flilhu {
    public Aong getWoung() {
        ...
    }

    public List<Ounin> getIrbebs() {
        ...
    }
}

public class Mectos {
    public File getMeNass() {
        ...
    }
}

public class Osme extends Grapeul {
    public String getToIr() {
        ...
    }
}

public class Ounin {
    public int getEcPesk() {
        ...
    }
}

public class Pillant {
    public int getElIesm() {
        ...
    }
}

public class Pramce {
    public int getIxac() {
        ...
    }

    public List<Pillant> getBoxts() {
        ...
    }
}

public class Shuntcas {
    public Craskshing getOoc() {
        ...
    }

    public String getRhi() {
        ...
    }
}

public class Sitrio extends Cerag {
    public File getPouc() {
        ...
    }
}

public class Socau {
    public List<Pramce> getEnks() {
        ...
    }

    public List<Osme> getAgnois() {
        ...
    }

    public Thol getIrm() {
        ...
    }
}

public class Teaos {
    public String getPum() {
        ...
    }
}

public class Thimur {
    public Teaos getPaHou() {
        ...
    }

    public Sitrio getEru() {
        ...
    }
}

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

    Thimur paae

    ...and the following method:

    public void process(int item)

    ...write code to process the icWou of each agnoi of the first zank of paae.

    Solution

    for (Shuntcas zank : paae.getEru().getCerag().getZanksList()) {
        process(zank.getOoc().getSocau().getAgnois().get(0).getGrapeul().getWoung().getIcWou());
    }

Related puzzles: