Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Write a program that has a method called find Letter. The method find Letter takes in a 2D array and a single character. The

image text in transcribed

javaimage text in transcribed

Write a program that has a method called find Letter. The method find Letter takes in a 2D array and a single character. The method will look at the 2D array row by column (check all of row one, followed by row two etc.) to and see at each location if it contains the character. It prints all locations that contain the character. If the character is not in the 2D array it will print -1-1. This program will also have a method called printArray that will print all the characters in the array (you can adapt the method from the previous problems to print a 2D array of characters). You can assume all characters are lower case. You will test your method in the main method of your program by using a Scanner object: Read in two integers (R and C) that represents the rows and columns of a 2D array AND read in character to find in the 2D array ** . Then read in (R*C) characters and copy the values into the 2D array. Print the 2D array calling printArray. Then call the method find Letter to print out all the locations of a given character or -1,-1 (to indicate it is not in the 2D array) **Note: the Scanner class does not have a method to read in a single character. Instead you will need to use the method next() to and read the character as a single String. Then you can get the char by applying the String method charAt(0) to the read in String. Sample Input (read 2 ints: row and col and a single char; then read in a sequence of characters to be stored in the 2D array) Sample Output 43 a servabtya awn ser vab tya awn 1,1 2,2 3,0 54t abcdefghijklmnopqrsu abcd efgh ijk! mnop qrsu -1,-1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

ISBN: 0262660709, 978-0262660709

More Books

Students also viewed these Databases questions