In anticipation of the upcoming
presidential election, your group is
asked to design an election (voting) system. The story below explains
how the system is intended to be used.
You are asked to create a system to support an election. There are
candidates running for an office.
Only registered voters are allowed to vote. When asked to vote, a voter
responds by indicating the one candidate he or she prefers over
all the others in this
election. It should be possible at any point to determine the current
tally of a candidate.
End of story
Work on defining objects to capture this system.
In your team, ideally this will involve evaluation of various design
choices. Don't just go along with what somebody says. Try to come up
with something different so you can discuss the merits and disadvantages
of various approaches.
- Make a new package in a team member's
- Every kind (type) of object your team need becomes a class.
Add the classes to the new package as you go.
- Every behavior you need of an object becomes a method for that
object. Add those methods as you go. But don't enter code beyond
a return statement. Let's keep these methods as stubs.
- Every class you define should have a String toString() method,
which should return something meaningful about the class. You can use
the other methods you define from toString() (for example,
getBalance() for the Account object).
- As you develop these classes, there should be no red flags in
your code. Fix the ones that come up as quickly as you can without
entering much code.
- The parameters and return types of the stub methods will likely change
as your discussion evolves. This is expected, and indicates the progress
of your team's discussion.
- Information you need "between" the methods is represented by
instance variables as discussed in class (an
balance). Add declarations of such instance variables to your stubs.
Use the instance variables where you can in your stubs.
- Generate Javadoc for your stubs using the instructions given
- Admire your handiwork and rejoice in a job well done, while you can,
- In a little while, a TA
will come by with a die,
which your group will throw to determine the
modification to the above story (** evil laughter from professor ensues**).
- Copy and paste the project into a new spot.
- Discuss how to accommodate the modification.
- Change the copy to reflect the new design.
- Generate Javadoc again, and turn this in as your group's design.
Last modified 12:45:19 CDT 23 September 2008
by Ron K. Cytron