...
The VotingMachine class has two method for reading the current state, getDemocratTally() and getRepublicanTally(), and three methods for altering the state, clear(), voteDemocrat() and voteRepublican(), with the following behavior:
- getDemocratTally - returns the current number (an int) of democrat votes
- getRepublicanTally - returns the current number (an int) of republican votes
- voteDemocrat() - registers a(nother) democrat vote
- voteRepublican() - registers a(nother) republican vote
- clear - clears all the votes and returns to the initial state
...
JExercise test code for this exercise can be found here: stateandbehavior/VotingMachineTest.java. Original-koden (jextest) finner du her: stateandbehavior/VotingMachine.jextest.
Include Page | ||||
---|---|---|---|---|
|
...