Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I need help with my Java assignment. Please let me know if you need additional information, thank you in advance. Write a program that
Hello, I need help with my Java assignment. Please let me know if you need additional information, thank you in advance.
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 findLetter 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 ser 43 a servabtya awn vab tya a wn 1,1 2,2 3,0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started