Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image 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 (RC) 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 Sample Output characters to be stored in the 2D array) 4 3 a servabt ya awn ser vab tya a wn 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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions