CS 111 - Introduction to Computer Science
Homework #10


Due: Tuesday 4/4 at the beginning of your lab section

1. Pig Game: In file Pig8.java, modify your two-computer simulation (Pig6.java) so that one of the players is randomly chosen to be the user.  Prompt the user for decision from standard input, with an empty string (return/enter) indicating a decision to roll, and any other input line indicating a decision to hold.  An example transcript is here.

2. Word List: Call your program WordArray.java.  Use an ArrayList<String> to support the following commands from standard input:

All commands should have thorough error handling.  You should given appropriate error messages when one tries to remove a non-existent word, tries to insert a word beyond the end of the list, omits a required command token, etc.  Think through all case scenarios.

Additionally, create and submit a file test.txt with command input that exercises all lines of code.