Question: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stan = new Scanner( System.in ); System.out.println(Enter a string); String str =

import java.util.Scanner;

public class Main { public static void main(String[] args) { Scanner stan = new Scanner( System.in ); System.out.println("Enter a string"); String str = stan.nextLine(); System.out.println("How many rows and columns? "); int numR = stan.nextInt(); int numC = stan.nextInt(); // call the create method // print out the returned array using enhanced for loops

} public static String[][] create( String s, int numRows, int numCols ) { /* Create a 2D array of strings with the given number of rows and columns Fill the array with characters from the parameter string in row-major order. If there are not enough characters in string to fill the array, the remaining elements get periods. If there are more characters in the string than number of elements of the 2D array, then the extra characters are ignored. Precondition: numRows and numCols are both positive. The unit program packet has examples. */

return null; // placeholder } }import java.util.Scanner; public class Main { public static void main(String[] args) {

Complete the create method and then complete the main method. The create method creates a 2D array of strings with the given number of rows and columns. Then it fills the array with characters from the parameter string in row-major order. If there are not enough characters in string to fill the array, the remaining elements get a period. Example 2 Enter a string dog Example 1 Enter a string SOMETHING How many rows and columns? 24 S O . E T . N How many rows and columns? 32 d o 8 Remember to comment your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!