In the picture below, the green rectangles represent people still in the circle, while the black rectangles represent people still under consideration. The red rectangles represent the people who are counting off.
Fill in the appropriate numbers and then press the "start" button to begin.
Your implementation should include two instance variables: list, a vector to hold all survivors, and current, an integer which specifies which element of the vector corresponds to the person in the circle who is currently being pointed at. Virtually all of the operations of the class are specified relative to the current element. For example next moves the current element to refer to the next person (if the current person is last in the vector, then current must shift to the element at the beginning of the list: 0). The other operations should be clear from their names and the pre and post-conditions given for them. Notice that it is quite important to notice what happens to the current indicator after each operation. For example, after removeCurrent(), the current element becomes the element after the one removed (unless the list becomes empty, in which case there is no current element - indicated by setting current to -1).
One word of warning, the Metrowerks applet viewer seems to have a bug which causes it to hiccup occasionally (and unpredictably) during execution of this program and give the wrong answer. The keyword "synchronized" added to the beginning of each method seems to keep this from happening quite as often (it really should be necessary only with parallel programs with several threads executing concurrently). If you get this strange hiccup, run the program again (a slower speed may help) and it should go away. If it repeats consistently, it is a bug in your program! None of the browsers seems to have this bug, so if in doubt open your ".html" file with Internet Explorer or Netscape.