Write the program for the GUI Applet called Survivor. This game uses an ArrayList to hold any number of persons. The names are entered one at a time at the first of the game. A person is removed every time the "Vote a Player off " button is clicked. The game does this by choosing one of the ArrayList elements randomly. Obviously, the ArrayList's logical size is updated automatically and shifting of persons after a removal is done automatically. The list of persons should be redisplayed in the text area after each person is added and after a person is removed. All previous information should be erased very time a person is added or removed. When the ArrayList holds only one person, then the game is over and that person should be displayed as the winner in the text area and in a message box. The last person to be removed should also be displayed in the text area. The game should have a "Reset Game to Start Over" button that clears the text area and displays the opening message and reinitializes the array for input. Make use of the ArrayList method clear() to do this.
|