Class relationships: Correct Solution


Consider the follow class declarations:

public class AngPri {
    public byte[] getEdgoo() {
        ...
    }
}

public class Boistmess {
    public File getToc() {
        ...
    }
}

public class Cieng {
    public Krantea getSto() {
        ...
    }

    public List<EloIsmam> getRevas() {
        ...
    }
}

public class Eble {
    public List<String> getSebes() {
        ...
    }
}

public class EloIsmam extends ErmMondeurd {
    public Tropad getHoWuou() {
        ...
    }
}

public class ErmMondeurd extends Eble {
    public byte[] getUrco() {
        ...
    }
}

public class Feestbe extends Gend {
    public Reth getEdMe() {
        ...
    }

    public Boistmess getSacel() {
        ...
    }
}

public class Gend {
    public List<String> getOrOn() {
        ...
    }
}

public class Krantea {
    public String getCoou() {
        ...
    }
}

public class Qauf extends Cieng {
    public String getHeGudo() {
        ...
    }
}

public class Raichu {
    public List<String> getAngri() {
        ...
    }
}

public class Reth extends Trimin {
    public List<AngPri> getShies() {
        ...
    }
}

public class Speshre extends UodRarhim {
    public int getPerdi() {
        ...
    }
}

public class Stio {
    public File getSceni() {
        ...
    }
}

public class Trimin {
    public String getWured() {
        ...
    }

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

public class Trir {
    public List<Qauf> getIals() {
        ...
    }

    public int getCeer() {
        ...
    }
}

public class Tropad {
    public List<Feestbe> getImbs() {
        ...
    }

    public List<Raichu> getGhus() {
        ...
    }
}

public class UodRarhim {
    public Trir getWhox() {
        ...
    }

    public List<Stio> getIseis() {
        ...
    }
}
  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:

    Speshre ses

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the nism of the first imb of the first reva of each ial of ses.

    Solution

    for (EloIsmam reva : ses.getUodRarhim().getWhox().getIals().get(0).getCieng().getRevasList()) {
        for (Feestbe imb : reva.getHoWuou().getImbsList()) {
            process(imb.getEdMe().getTrimin().getNism());
        }
    }

Related puzzles: