Class relationships: Correct Solution


Consider the follow class declarations:

public class CeaFiss {
    public File getHiou() {
        ...
    }

    public List<Ioll> getOataxs() {
        ...
    }
}

public class Derclurd extends CeaFiss {
    public byte[] getGuek() {
        ...
    }
}

public class Diohol {
    public int getCoist() {
        ...
    }
}

public class Erpled extends OngNois {
    public byte[] getLio() {
        ...
    }
}

public class Fepran {
    public String getSeo() {
        ...
    }
}

public class Flinreng {
    public List<String> getIdTud() {
        ...
    }

    public Grouth getPhoor() {
        ...
    }
}

public class Grouth {
    public int getWeCil() {
        ...
    }

    public List<Derclurd> getElEts() {
        ...
    }
}

public class Huliu {
    public File getTuCenin() {
        ...
    }
}

public class Huwkess {
    public File getGaHefal() {
        ...
    }
}

public class Ioll extends Rearno {
    public Huliu getSiec() {
        ...
    }
}

public class NalSlencos {
    public Fepran getAng() {
        ...
    }

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

public class Odphew {
    public int getErbis() {
        ...
    }
}

public class OngNois {
    public List<Odphew> getReBerds() {
        ...
    }

    public Skond getViSpaw() {
        ...
    }
}

public class Rearno {
    public File getOcGoje() {
        ...
    }

    public int getEcFo() {
        ...
    }
}

public class Skond extends Diohol {
    public XorKnewra getEdsod() {
        ...
    }

    public List<Huwkess> getSeBes() {
        ...
    }

    public List<Flinreng> getUnds() {
        ...
    }
}

public class XorKnewra extends NalSlencos {
    public File getArBebli() {
        ...
    }
}
  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:

    Erpled sese

    ...and the following method:

    public void process(int item)

    ...write code to process the ecFo of the first oatax of the first elEt of each und of sese.

    Solution

    for (Derclurd elEt : sese.getOngNois().getViSpaw().getUnds().get(0).getPhoor().getElEtsList()) {
        for (Ioll oatax : elEt.getCeaFiss().getOataxsList()) {
            process(oatax.getRearno().getEcFo());
        }
    }

Related puzzles: