Class relationships: Correct Solution


Consider the follow class declarations:

public class Aeng {
    public List<Spop> getSeOnugs() {
        ...
    }

    public int getSpo() {
        ...
    }
}

public class Cheistva {
    public int getCecdo() {
        ...
    }
}

public class Clauss {
    public IliJenthpiou getFras() {
        ...
    }

    public Ziaxsia getIsec() {
        ...
    }
}

public class Doprost {
    public String getHuCheil() {
        ...
    }
}

public class Dreolhot {
    public List<String> getVeu() {
        ...
    }

    public List<Flantwen> getHaHeas() {
        ...
    }
}

public class Easo extends Epciouth {
    public List<Timhor> getNaOrs() {
        ...
    }

    public File getNal() {
        ...
    }
}

public class Epciouth {
    public File getKuc() {
        ...
    }
}

public class Flantwen {
    public List<Clauss> getChouns() {
        ...
    }

    public List<TroRusdes> getHeIns() {
        ...
    }
}

public class Gintpent {
    public String getEcpod() {
        ...
    }
}

public class IliJenthpiou extends Phipeat {
    public List<String> getOrga() {
        ...
    }
}

public class Jacke {
    public List<String> getJaom() {
        ...
    }
}

public class Kosmspat extends Easo {
    public Cheistva getMimen() {
        ...
    }
}

public class OriKhalalt extends Dreolhot {
    public int getPhou() {
        ...
    }
}

public class OssCenfleouck {
    public List<Rafi> getAnMahods() {
        ...
    }

    public File getIcMase() {
        ...
    }
}

public class Phipeat {
    public String getMoWoc() {
        ...
    }

    public Kosmspat getAsIntcu() {
        ...
    }
}

public class Rafi {
    public OriKhalalt getDomuf() {
        ...
    }

    public List<Doprost> getStes() {
        ...
    }
}

public class Scongpra {
    public File getPtess() {
        ...
    }

    public Sehes getIodes() {
        ...
    }
}

public class Sehes extends OssCenfleouck {
    public Aeng getCear() {
        ...
    }
}

public class Spop {
    public File getGir() {
        ...
    }
}

public class Timhor {
    public int getArnau() {
        ...
    }
}

public class TroRusdes extends Jacke {
    public List<Gintpent> getDawases() {
        ...
    }
}

public class Ziaxsia {
    public List<String> getEeod() {
        ...
    }
}
  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:

    Scongpra elgo

    ...and the following method:

    public void process(File item)

    ...write code to process the nal of the first choun of the first haHea of each anMahod of elgo.

    Solution

    for (Flantwen haHea : elgo.getIodes().getOssCenfleouck().getAnMahods().get(0).getDomuf().getDreolhot().getHaHeasList()) {
        for (Clauss choun : haHea.getChounsList()) {
            process(choun.getFras().getPhipeat().getAsIntcu().getEaso().getNal());
        }
    }

Related puzzles: