Question: /* Method one2TwoD: (Problem 2) 10 pts * Given a ld array of integers A, you are to produce (and return) a 2D array B

 /* Method one2TwoD: (Problem 2) 10 pts * Given a ldarray of integers A, you are to produce (and return) a 2D

/* Method one2TwoD: (Problem 2) 10 pts * Given a ld array of integers A, you are to produce (and return) a 2D array B of integers that is as follows: B has as many rows as A.length B has as many columns as A.length B contains only values o except for its diagonal elements: for all elements B[i][i], we have B[i][i] = A[i]. * Note: you get bonus points when you implement this method using only one for loop. -- 3 pts */ public int[][] one2TwoD(int[] A) { int[][] B = new int[1][1]; // to be modified of course :) return ""; } /* Method one2TwoDMulti: (Problem 3) 10 pts * Given a ld array of integers A, you are to produce (and return) a 2D array B of positive integers that is as follows: B has as many rows as A.length Each ith row of B is of length A[i] and contains only values A[i] public int[][] one2TwoDMulti(int[] A) { int[] [] B = new int[1][1]; // to be modified of course :) return B; } /* Method string2Array: (Problem 4) 10 pts * Given a string str, you are to produce (and return) a ld array s of strings of length = the length of str, * and where each element S[i] = str.substring(0,1+1). */ public String[] string2Array(String str) { String[] $ = new String[1]; // to be modified of course :) return s; } /******For testing one2TwoD int[] z = {1, 2, 5, 3}; int[][] B testing.one2TwoD(z); for (int i 0; i

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!