Here is one more assignment about Color objects using the CS10Display class from
assignment 1. This one applies the Part 1 creates a class that manages a color grid. Part 2 applies the class from
part 1 by allowing a user to specify the size and colors of the grid. Skeleton files for
each part are provided if you want to use them or parts of them, but you are not required
to do so. Copies of these skeleton files and the tester class for part 1 are in
|
grid() method returns original array, not a copy
DISPLAY
and QUIT
cases, and it calls
seven (now incomplete) methods to handle the other cases. Your only job, if you decide to start
with this skeleton, is to implement these seven methods. You may invoke the helper methods as needed
- in fact, please at least use the printError
methods for consistency - and you may
add other helper methods if you want.
Scanner
reference as its first parameter. In main, this reference was associated with the line of text
last entered by the user, and the first token was removed (it was a command, like SET
).
So if there is another token (s.next()
is true), then it must be one of the
allowable arguments for that command. See this explanation of
commands and rules.
ColorGrid
object. All are void
methods except newGrid
.
Normally that method returns a reference to a new ColorGrid, but it just returns
the existing grid reference if valid data are not entered.
java GridMaker < testdata.txt
turnin hw3@cs10 ColorGrid.java GridMaker.java