java - Deleting from a 2D array -


I am making a method that takes in grades (A 100, q68, etc.), that grade is 2D array Deletes the shape of the array, and the first letter of the grade determines the category that is in the grade, and the remaining grade. If the grade was destroyed and wrong otherwise this method tells the truth. Here's my code so far I know I'm missing something, but I'm not sure what this is.

Public Boolean Deletion Grade (String Negrades) {char row = newGradeIn.charAt (0); Double grade = double. PRADABB (Newgrade in. Substring (1)); Int index = character rouge (line); If (index == -1) {return false; } Double [] Old ARR = Graditude [index]; Double [] newArr = Arrays.copyOf (old order, old rule. Length - 1); Newer [NewArm. Lamp + 1] = grade; Gradetable [index] = newer; Back true; Your argument to remove from the array is not correct Change the code below

  double [] old arm = gradetable [index]; Double [] newArr = Arrays.copyOf (old order, old rule. Length - 1); Newer [NewArm. Lamp + 1] = grade; Gradetable [index] = newer;  

with the following

  double [] OLD ARR = GradTable [index]; Double [] newArr = new double [old Aror. Lamps - 1]; Int i = 0; (Double element: old arrow) {if (element! = Grade) {newArr [i ++] = element; }} Gradtable [index] = newer;  

Here we will repeat through all the elements to find the actual grade and delete it. Note: The scenario in which the grading is not present is considered.


Comments