Ballot as Composite, Chain for Tally


Implement a ballot for the online voting system. Use the composite design pattern. Remember to make the proper factories for component objects, and make the factories singletons. Then implement a chain of responsibility to do tallying of voted ballots.

You may use this code for your composite ballot, or you may build on your own solution to the ballot composite exercise.

The code at my link has a hierarchical structure on a set of issue that would be give to ONE individual voter. Thus as election would have lots of these ballot composite objects, one per voter, and organized somehow (perhaps as another composite).

Whether you use this ballot, or your own code, what I want to see is a chain of tally "processors" where each processor in the chain does a different sort of tally. Pass all the ballots down the chain individually, or a a collection... whatever fits your code best.

Make an appropriate main "app" to create and vote ballots and drive the tallying, and reporting.