Problem specification: In this assignment, you will search for a word in square sized grid of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem specification: In this assignment, you will search for a word in square sized grid of letters. You will write a Java program that reads a grid of letters and a specified word from the user, counts how many times the word appeared in the grid in horizontal orientation (from left to right or from right to left), vertical orientation (from top to bottom or from bottom to top) or diagonal orientation (from upper left to lower right, from lower right to upper left, from upper right to lower left or from lower left to upper right) and prints the total count. An example is shown here where the grid size is 7X7 and you can find the word CAT in all possible orientations. Your program should print how many times in total the specified word appeared in the grid in any of these orientations. Input specification: The input starts with an integer N which represents the grid size (NXN). Next, N lines will follow where each line represents a row of letters. Each line will have exactly N letters in them. The last line is the word you have to search in the grid. The number of characters in the last line does not exceed N. You can assume that the value of N will not exceed 10000. Sample input: 4 WORD OODW RDRO Output specification: The output of your program is a single integer that represents the number of times the word is found in the grid. Note: You must not print anything extraneous (such as "Please enter N" or "the result is"). DWOD WORD 3 ABA BAB ABA AB C TGOC FX AVAATAC Sample output: 3 TUTCZ PM GDCEST B OHQAATL DNXCTAK Y CATRC J 12 Problem specification: In this assignment, you will search for a word in square sized grid of letters. You will write a Java program that reads a grid of letters and a specified word from the user, counts how many times the word appeared in the grid in horizontal orientation (from left to right or from right to left), vertical orientation (from top to bottom or from bottom to top) or diagonal orientation (from upper left to lower right, from lower right to upper left, from upper right to lower left or from lower left to upper right) and prints the total count. An example is shown here where the grid size is 7X7 and you can find the word CAT in all possible orientations. Your program should print how many times in total the specified word appeared in the grid in any of these orientations. Input specification: The input starts with an integer N which represents the grid size (NXN). Next, N lines will follow where each line represents a row of letters. Each line will have exactly N letters in them. The last line is the word you have to search in the grid. The number of characters in the last line does not exceed N. You can assume that the value of N will not exceed 10000. Sample input: 4 WORD OODW RDRO Output specification: The output of your program is a single integer that represents the number of times the word is found in the grid. Note: You must not print anything extraneous (such as "Please enter N" or "the result is"). DWOD WORD 3 ABA BAB ABA AB C TGOC FX AVAATAC Sample output: 3 TUTCZ PM GDCEST B OHQAATL DNXCTAK Y CATRC J 12
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class Puzzle public static void mainString args Scanner scan new Scann... View the full answer
Related Book For
Fundamental Managerial Accounting Concepts
ISBN: 978-1259569197
8th edition
Authors: Thomas Edmonds, Christopher Edmonds, Bor Yi Tsay, Philip Olds
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Ticket to Ride is a popular board game that involves connecting cities in a given railroad network. In this assignment you will prototype some potential approaches for creating an AI player for this...
-
In this assignment you will write a program that will simulate a storage area with collections of items. Items can be added, removed, and the user can check the value of an item. This assignment does...
-
Suppose that a client performs an intermixed sequence of push and pop operations on a pushdown stack. The push operations insert the integers 0 through 9 in order onto the stack; the pop operations...
-
Consider Kremers 0-ring model. There are 4 workers in this economy, Jack, Fred, Melbaand Daphne. Suppose that there are two firms and each firm hires only two workers ,each workers , each of whom has...
-
Midland Resources has two production departments (Fabrication and Assembly) and three service departments (Engineering, Administration, and Maintenance). During July, the following costs and service...
-
The following MINITAB output presents a multiple regression equation y = b0 + b1x1 + b2x2 + b3x3 + b4x4 + b5x5. It is desired to drop one of the explanatory variables. Which of the following is the...
-
A rod of diameter D = 25 mm and thermal conductivity k = 60 W/m. K protrudes normally from a furnace wall that is at Tw = 200C and is covered by insulation of thickness L ins = 200 mm. The rod is...
-
This week we are examining the relationship between motivation theory and pay structure within organizations. Employees are motivated in various ways to perform at work. All employees seek a certain...
-
Pik Corporation acquired 80 percent of Sel Corporation's common stock on January 1, 2011, for $210,000 cash. The stockholders' equity of Sel at this time consisted of $150,000 capital stock and...
-
Spamela Hamderson Inc. reports the following pretax income (loss) for both financial reporting purposes and tax purposes. (Assume the carryback provision is used for a net operating loss.) Year...
-
The following information pertains to ABC Corporation: Beginning raw materials inventory $37,000 Ending raw materials inventory $45,000 Beginning work-in-process inventory $18,000 Ending...
-
ABC Manufacturing currently produces 2,000 glasses per month. The following per unit data apply for sales to regular customers and is based on 1,000 units produced. Direct materials $200 Direct...
-
On May 1, 2022, Cullumber Company purchased the copyright to Bramble Corp. for $134400. It is estimated that the copyright will have a useful life of 4 years. What would be the amount of amortization...
-
A2 Milk want to acquire Noumi. Briefly describe the valuation method chosen, namely, the fundamental and relative valuation methods used. Justify the choice of model and any significant assumptions...
-
How do ethical leaders demonstrate authenticity and ethical authenticity, aligning personal values with organizational goals, and modeling ethical behavior to cultivate ethical awareness and...
-
Equipment costing 110,000 will be placed in use in early July 2020 operating until early December of 2023 at which time it will be scrapped. No loans are planned. Direct revenue and direct costs of...
-
Use integration by parts to evaluate the following. Check your answer by taking the derivative. x2e-xdx
-
Fullerton Paper Products Corporation produces paper cups using two production departments, printing and forming. Beginning balances and printing department data for 2018 follow: Accounts Beginning...
-
Vogel Company manufactures scanners that sell for $150 each. The company pays $60 per unit for the variable costs of the product and incurs fixed costs of $1,800,000. Vogel expects to sell 60,000...
-
Airdrie Department Store is divided into three major departments: Men's Clothing, Women's Clothing, and Home Furnishings. Each of these three departments is supervised by a manager who reports to the...
-
What is thermodynamics?
-
Explain the scope and limitations of thermodynamics.
-
An astronaut weighs \(800 \mathrm{~N}\) on the earth's surface where the acceleration of gravity is \(g=9.83 \mathrm{~m} / \mathrm{s}^{2}\). The mass and the radius of the moon are \(7.4 \times...
Study smarter with the SolutionInn App