Give a non-void Java method called "moveRow" that has three parameters: an array of chars "board," a char "dir," and an int "r." The method should copy row "r" either up or down depending on whether...


In java please


Give a non-void Java method called

Extracted text: Give a non-void Java method called "moveRow" that has three parameters: an array of chars "board," a char "dir," and an int "r." The method should copy row "r" either up or down depending on whether dir is 'U' or 'D! respectively. For example, consider the following 2D array: hrfak bnoqs klqp z Camzp tyuwb If moveRow is call on the above array with dir='U' and r-3, then array would be modificd as follows: hrfak bnogs camz p camz p tyu wb On the other hand, if moveRow is call on the above array with dir-'D' and r-1. then array would be modified as follows: hrfak bnoqs bnoqs Camz p tyuwb Note that you may assume that r is a valid row number, and that dir is either 'U' or 'D. However, you may not assumc the requcsted opcration is a valid operation. For example, if the method is called on the above array with dir = 'D' and r-4, then the operation cannot be porformed. Similarly, the operation cannot be performed if the mcthod is called on the above array with dir='U' and r-0. In these cases your method should not modify the array, but simply return false. If the operation can be performed, then your method should modify the array appropriately, and return truc.

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here