CS 630 - Computing Fundamentals I - Fall 2005
Homework 10
Loyola College >
Department of Computer Science >
CS 630 >
Homework >
Homework 10
Due
Monday, November 28th at the beginning of class
Problems
Exercise (p. 605)
11.1, 11.2, 11.7, 11.9
1) Write a code segment that does the following:
- Defines constants MAX_ROWS equal 25 and MAX_COLUMS equal to 10
- Defines a two-dimensional boolean array data with 25 rows, where each row consists of 10 elements.
- Initializes array data so that elements whose row subscript values are odd have the value true and initializes the other elements to false
2) Assume that you are creating a class Crossword which stores a crossword puzzle as a two dimensional array of characters. The Crossword class has the data field:
private char[][] puzzle;
which is allocated in the constructor and assigned letters. You will write two methods for this class.
- isDownAtPosition(String word, int row, int column) - This method determines if the word matches the letters in the puzzle traversing down the column starting at the position row, column. The method returns true or false.
- isDownWord(String word) - This method searches the puzzle to determine if the word occurs in the down direction in the puzzle. It should also return true or false.
Hint: Beware of the edge of the puzzle. You don't want to try to compare letters that are not present.
Programming Project
11.9