goal.
The goals of this assignment are to:
wordfind.
You need to write a program that will let you play a nonsense word find
game.
Your program will generate a 2-dimensional array of characters,
display the array to the user
and ask the user to enter "words" to find in the array.
The reason that "words" is in quotes is because the words are really
just sequences of letters and aren't necessarily words that belong to
any natural (i.e., spoken) language.
The 2-dimensional array that your program generates will be done
randomly, so there is no guarantee that it will actually contain any
real words from any language.
specifications.
Your program will do the following
(the overall logic of your code -- i.e., following the steps
outlined below -- is worth 0.6 points):
Keyboard
class, as below;
0.5 points)
and convert the input to an int
(0.2 points)
enter word to find (9 to quit):
(0.1 points)
Keyboard
class, as below)
findInRow()
method, as below;
0.8 points)
findInColumn()
method, as below;
0.8 points)
replaceInRow()
, 0.8 points;
or replaceInColumn()
, 0.8 points;
as below)
word not found
.
(0.1 points)
a.
notes.
program.
Your program will consist of 3 classes.
You can click on the links below for skeletons of the first
two classes.
You must write the third from scratch.
Keyboard
class.
As instructed by the comments in the code, write the following method:
public static String readline()
Square
class.
As instructed by the comments in the code, declare any necessary global
constants and/or variables, write a constructor and the
following methods:
public Square( int size )
public void init()
public void print()
public int findInRow( String s )
public int findInColumn( String s )
public int replaceInRow( int i,String s )
public int replaceInColumn( int j,String s )
hw4<yourCUNIXusername>.java
containing a single main method that controls the program
as it runs through the steps described in the specification
section (above).
sample run.
Below is a sample run.
The unix command line is highlighted in bold font.
unix$ java hw4eis2003 enter size for square: 10 clssqrdets wizibsyphg hrmagwpuge evuqmiisah iyvhvlfkkx ipzwehgdpl knjalmpjmc jkyniyzste ffkirnhfvg fyrwecsrzg enter word to find (9 to quit): lire clssqrdets wizibsyphg hrmagwpuge evuqmiisah iyvhvlfkkx ipzwehgdpl knja.mpjmc jkyn.yzste ffki.nhfvg fyrw.csrzg enter word to find (9 to quit): IS clssqrdets wizibsyphg hrmagwpuge evuqmi..ah iyvhvlfkkx ipzwehgdpl knja.mpjmc jkyn.yzste ffki.nhfvg fyrw.csrzg enter word to find (9 to quit): sssss word not found enter word to find (9 to quit): 9
source code.
Your source code (i.e., your .java
file) but be
neat and clearly commented.
You must have a header comment and you should comment the end of each
block (i.e., each }
).
You need to comment each method that you write within in each class.
submission.
Follow the submission instructions carefully!!!
If you don't, human intervention will be required to fix your
mistakes, and you will lose 0.5 points.
points.
This assignment is worth 7 points (out of 100 for the semester).
Distribution of points is: