Class relationships: Correct Solution


Consider the follow class declarations:

public class Aher {
    public byte[] getWec() {
        ...
    }
}

public class Aondon {
    public List<Phiaswu> getBlasms() {
        ...
    }

    public CesSpruc getRor() {
        ...
    }
}

public class Bangmas {
    public List<String> getHirho() {
        ...
    }

    public List<Lermi> getRepols() {
        ...
    }
}

public class BifScec {
    public List<String> getMeEd() {
        ...
    }
}

public class Cantses extends EniUsos {
    public List<String> getOuAnpo() {
        ...
    }
}

public class CesSpruc {
    public List<String> getIrdba() {
        ...
    }
}

public class Chunt {
    public int getOlAnu() {
        ...
    }
}

public class EaeTreien {
    public int getOsai() {
        ...
    }

    public List<Cantses> getSaOsels() {
        ...
    }
}

public class EniUsos {
    public byte[] getPhuo() {
        ...
    }

    public List<Aher> getMaOcials() {
        ...
    }

    public byte[] getPhiac() {
        ...
    }
}

public class Iwal extends Bangmas {
    public String getSor() {
        ...
    }
}

public class Lermi extends Phammif {
    public File getGaOd() {
        ...
    }
}

public class Phammif extends Chunt {
    public EaeTreien getGoAposs() {
        ...
    }
}

public class Phiaswu {
    public Iwal getOnGiss() {
        ...
    }

    public List<BifScec> getBias() {
        ...
    }

    public Thonges getDaenx() {
        ...
    }
}

public class Spanest {
    public byte[] getChu() {
        ...
    }
}

public class Stirles {
    public List<String> getCeli() {
        ...
    }
}

public class Thonges {
    public Stirles getQiEn() {
        ...
    }

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

    Aondon ce

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the phiac of each saOsel of the first repol of each blasm of ce.

    Solution

    for (Lermi repol : ce.getBlasms().get(0).getOnGiss().getBangmas().getRepolsList()) {
        process(repol.getPhammif().getGoAposs().getSaOsels().get(0).getEniUsos().getPhiac());
    }

Related puzzles: