Class relationships: Correct Solution


Consider the follow class declarations:

public class Bedmi {
    public File getUniou() {
        ...
    }

    public List<Longbash> getDious() {
        ...
    }

    public String getRaie() {
        ...
    }
}

public class Bishe {
    public byte[] getIrpad() {
        ...
    }
}

public class Blasm extends Splo {
    public byte[] getEhin() {
        ...
    }
}

public class Chasac {
    public String getOsm() {
        ...
    }
}

public class Firloo {
    public Chasac getHar() {
        ...
    }

    public Phen getOsPe() {
        ...
    }
}

public class Hass {
    public int getTreet() {
        ...
    }
}

public class IolPruk extends Pesm {
    public File getBuas() {
        ...
    }
}

public class Iosm extends TroEeod {
    public Oonban getEmhe() {
        ...
    }

    public Pospren getRil() {
        ...
    }

    public List<Bishe> getSiDisms() {
        ...
    }
}

public class Istsou extends Firloo {
    public String getIrEs() {
        ...
    }
}

public class Longbash {
    public File getWaBa() {
        ...
    }
}

public class Miha {
    public byte[] getDarfi() {
        ...
    }
}

public class Nont {
    public String getStal() {
        ...
    }

    public IolPruk getOan() {
        ...
    }
}

public class Oonban {
    public List<Rongcel> getCaMungses() {
        ...
    }

    public Blasm getCil() {
        ...
    }
}

public class Pesm {
    public String getInad() {
        ...
    }

    public List<Bedmi> getOlans() {
        ...
    }
}

public class Phen {
    public List<Iosm> getRaSes() {
        ...
    }

    public int getHuOchu() {
        ...
    }
}

public class Pospren {
    public String getOnthu() {
        ...
    }
}

public class Rongcel extends WepGioc {
    public Hass getMees() {
        ...
    }
}

public class Splo extends Miha {
    public List<String> getDrin() {
        ...
    }
}

public class TroEeod {
    public String getChosm() {
        ...
    }
}

public class WepGioc {
    public int getOaBoirk() {
        ...
    }

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

    Istsou dipe

    ...and the following method:

    public void process(String item)

    ...write code to process the raie of each olan of each epsod of each caMungs of the first raSe of dipe.

    Solution

    for (Iosm raSe : dipe.getFirloo().getOsPe().getRaSesList()) {
        process(raSe.getEmhe().getCaMungses().get(0).getWepGioc().getEpsods().get(0).getOan().getPesm().getOlans().get(0).getRaie());
    }

Related puzzles: