Class relationships: Correct Solution


Consider the follow class declarations:

public class Crul {
    public File getOsel() {
        ...
    }
}

public class Dousoc extends Kasmpa {
    public String getCeong() {
        ...
    }
}

public class Esesm {
    public List<String> getGaAdsin() {
        ...
    }
}

public class HuaLua extends Rigled {
    public List<QocNeient> getPaBles() {
        ...
    }
}

public class Jeatpro {
    public int getChre() {
        ...
    }
}

public class Kasmpa extends Crul {
    public Jeatpro getIdIn() {
        ...
    }

    public int getWhonu() {
        ...
    }
}

public class Niism {
    public List<Phan> getEsStefs() {
        ...
    }

    public File getClus() {
        ...
    }
}

public class Phan {
    public List<Esesm> getOucs() {
        ...
    }

    public HuaLua getEnte() {
        ...
    }
}

public class QocNeient {
    public File getNoar() {
        ...
    }
}

public class Rigled {
    public List<String> getPeSiau() {
        ...
    }

    public Dousoc getBaAr() {
        ...
    }
}
  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:

    Niism hous

    ...and the following method:

    public void process(int item)

    ...write code to process the whonu of the first esStef of hous.

    Solution

    for (Phan esStef : hous.getEsStefsList()) {
        process(esStef.getEnte().getRigled().getBaAr().getKasmpa().getWhonu());
    }

Related puzzles: