Trying to write it java first and then pseudo code

Assignment Help JAVA Programming
Reference no: EM13810449

A popular diversion in the United States, "word find" (or "word search") puzzles ask the player to find each of a given set of words in a square table filled with single letters. A word can read horizontally (left or right), vertically (up or down), or along a 45 degree diagonal (in any of the four directions) formed by consecutively adjacent cells of the table; it may wrap around the table's boundaries, but it must read in the same direction with no zigzagging. The same cell of the table may be used in different words, but, in a given word, the same cell may be used no more than once. Write a computer program for solving this puzzle.

Trying to write it java first and then pseudo code.

public class WordSearch {

private static ArrayList board = new ArrayList()

private static Scanner scanner

public static void readBoard() {

while (true) {

line = input next line

if (line equals NULL)

exit from loop

Delete all spaces in line, convert to Uppercase and add to board } }

public static void printBoard() {

rows = getRows();

for (row=0 to rows)

print board.get(row); }

public static int getRows() {

return the number of rows }

public static int getCols() {

return the number of columns }

public static void createScanner() {

try {

scanner = new Scanner(new java.io.File("WordSearchInput.txt")); }

catch (Exception e) {

exit from program } }

public static void processWords() {

while (scanner has a next word) {

word = scanner.next();

findWord(word); }

public static void findWord(String word) {

rows = get the number of rows

cols = get the number of columns

for (row=0 to rows)

for (col=0 to cols)

findWord(word,row,col); }

public static void findWord(String word, int row, int col) {

for (drow=-1 to 1)

for (dcol=-1 to 1)

findWord(word,row,col,drow,dcol); }

public static void findWord(String word, int row, int col, int drow, int dcol) {

rows = get the number of rows

cols = get the number of columns

for (offset=0 to word.length) {

targetRow = row + offset*drow;

targetCol = col + offset*dcol;

if ((targetRow is less than 0) OR

(targetRow is greater than equal to rows) OR

(targetCol is less than 0) OR

(targetCol is greater than equal to cols))

return

boardChar = board.get(targetRow).charAt(targetCol);

wordChar = word.charAt(offset);

if (boardChar not equal to wordChar)

// mismatch, so we're done

return }

print (word, row, col, drow, dcol); }

public static void main(String[] args) {

createScanner();

readBoard();

printBoard();

processWords(); } }

}

Reference no: EM13810449

Questions Cloud

Define the kent and kendall visions of intelligence : What are the most important differences between the Kent and Kendall visions of intelligence. Why are these differences so important and worth discussing. Which vision might be most applicable today and why
What is the variance of these returns : Five years ago, you purchased 600 shares of stock. The annual returns have been 7.2 percent, -19.4 percent, 3.8 percent, 14.2 percent, and 27.9 percent, respectively. What is the variance of these returns?
Use a spreadsheet to construct a pareto chart : The following data is collected from customer complaints about service problems at a hotel. Complaint types are coded A-G. Use a Spreadsheet to construct a Pareto chart for this data.
How should a manager motivate his or her staff members : An essay presents a well-argued discussion or response to a question using analysis and critique of relevant literature. It establishes a proposition or thesis and presents a point of view based on evidence. An essay is written in a logically stru..
Trying to write it java first and then pseudo code : A popular diversion in the United States, "word find" (or "word search") puzzles ask the player to find each of a given set of words in a square table filled with single letters. Trying to write it java first and then pseudo code
Determine before tax-costs of debt financing of bond : Use the information below to determine before tax-costs of debt financing of bond S:
Level of detail needed for a complete cost estimate : How will you reach the level of detail needed for a complete cost estimate? What items should you include in your cost estimate that are not explicitly present in the project schedule?
Define men and women handle disease differently : men and women handle disease differently
Genesis energy capital plan report : The Genesis Energy operations management team, nearing completion of its agreement with Sensible Essentials, was asked by senior management to present a capital plan for the operating expansion. The capital plan was not to be a wish list but an analy..

Reviews

Write a Review

JAVA Programming Questions & Answers

  What method do you use to set the location of a frame

Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button.

  Create a website

The preplanning design consists of a document that defines the element specifically requested by the client and indicates where these features will be located on the Website

  Write a program that prompts the user to input an integer

Write a program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits.

  Class should have a method that returns the average

Write a class named TestScores. The class constructor should accept an array of test scores as its arguments. The class should have a method that returns the average of the test scores.

  Write a one-class java program

Write a one-class Java program with at least one method (besides main) to determine if the data in your dataset (i.e., in data.txt) follows Benford's law.

  Write paper about focuses on the popularity of java

You will write a 4-5-page research-oriented paper in APA format that focuses on the "Popularity of Java"

  The code must take into account

The code must take into account leap year and adding or subtracting between years. Write two additional methods that you come with on your own as well.

  Create a complete java application

Create a complete Java application that meets these requirements and the program has an opening comments section (using block comments) with the file name, date, your name, and purpose of the program.

  Java program for line item application

This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c:java1.6ch06LineItem directory and review this code.

  Write a method in java that uses a switch statement

Write a method in JAVA that uses a switch statement and takes a person's age using an integer parameter , then checks if the age is valid (0-110), and then RETURNS a string based on the age

  Java program that prompts the user to input an integer

Write a Java program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits.

  Implement avl trees that allows both iterative traversal

implement avl trees that allows both iterative traversal and recursive traversal.iterative traversal is fairly easy if

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd