Class relationships: Correct Solution


Consider the follow class declarations:

public class Cocnom extends Trulo {
    public byte[] getIalo() {
        ...
    }
}

public class Dossuoun {
    public String getCau() {
        ...
    }

    public File getCliss() {
        ...
    }
}

public class EsmBir {
    public String getNiRer() {
        ...
    }
}

public class GomBoaer extends Senmac {
    public int getSerro() {
        ...
    }
}

public class Imca extends Itbo {
    public QinNuiz getLaa() {
        ...
    }
}

public class Itbo {
    public File getPri() {
        ...
    }
}

public class Lesmi extends Singslo {
    public byte[] getPoMelme() {
        ...
    }
}

public class Pirer {
    public byte[] getBiass() {
        ...
    }
}

public class QinNuiz {
    public File getAspir() {
        ...
    }
}

public class Renrar {
    public Lesmi getAchlu() {
        ...
    }

    public List<GomBoaer> getCocs() {
        ...
    }
}

public class Senmac {
    public List<String> getNue() {
        ...
    }
}

public class Shek {
    public List<Renrar> getWesas() {
        ...
    }

    public List<EsmBir> getIcuis() {
        ...
    }
}

public class Singslo extends Imca {
    public Pirer getDair() {
        ...
    }

    public Tilcil getElDe() {
        ...
    }
}

public class SmeSqane {
    public List<Cocnom> getCrils() {
        ...
    }

    public int getPhe() {
        ...
    }
}

public class Tilcil {
    public List<String> getFeefi() {
        ...
    }

    public List<Dossuoun> getBilhas() {
        ...
    }
}

public class Trulo {
    public List<String> getPla() {
        ...
    }

    public Shek getEdtal() {
        ...
    }
}
  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:

    SmeSqane egar

    ...and the following method:

    public void process(File item)

    ...write code to process the cliss of the first bilha of the first wesa of each cril of egar.

    Solution

    for (Renrar wesa : egar.getCrils().get(0).getTrulo().getEdtal().getWesasList()) {
        for (Dossuoun bilha : wesa.getAchlu().getSingslo().getElDe().getBilhasList()) {
            process(bilha.getCliss());
        }
    }

Related puzzles: