Problem 1.3.27, an N-by-N checkerboard composed of characters of your choice. The book says to alternate stars and spaces, but you might find some other pattern more pleasing.
Two ways to go:
[1] Get N from the command line. Call this program Cboard.java.
[2] Use SkeletonTwo for Cboard2.java as a foundation and get N within the program. (This will require some extra study.) Loop around so that the user can try various values of N.
Extra credit. Make a bigger checkerboard, for example, with each square made something like this:
***
***
***
Do arithmetic with N so that the individual squares are of the largest size possible (1-by-1, 2-by-2, etc.) without making too long a line and messing up the console screen.
Whether you choose option 1 or 2, make sure that the program responds graciously to inputs that don't make good checkerboards.
Due at 4:30 pm sharp on Tuesday. Bring a hard copy to class (or fax it) and send code in an e-mail, subject "201 homeword 1.3 checkerboard," before class.
Next homeworks: 1.3.37 trig functions, 1.4.28 find duplicates, 1.4.30 minesweeper; due dates not yet determined.
Quiz, sections 1.1 to 1.4, on Thursday, September 18.
Thursday, September 11, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment