Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Identify at least 15 issues from this java code, write your comments to improve this code. 1 2 3 4 5 6 7 8 import
Identify at least 15 issues from this java code, write your comments to improve this code.
1 2 3 4 5 6 7 8 import java.io. BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io. PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Scanner; import java.util.StringTokenizer; public class Matrix { private int m_rows; private int n_cols; private double[] [] arr; IE 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 public Matrix(int m, int n) { this.m_rows = m; this.n_cols = n; this.arr = new double [m][n]; for (int i = 0; i 3) { System.out.println("Matrix too large -- Cannot find determinant"); return -1; } if (this.m_rows == 1) { return this.arr[0][0]; } else if (this.m_rows == 2) { result = (this.arr[0][0] * this.arr[1][1]) - (this.arr[:] [O] * this.arr[0][1]); 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 } else if (this.m_rows == 3) { result = (this.arr[0][0] * this.det_2x2 (0)) - (this.arr[1][0] * this.det_2x2 (1)) + (this.arr[2][0] * this.det_2x2 (2)); return result;// error case private double det_2x2 (int rowx) { if (rowX == 0) return (this.arr[1][1] * this.arr[2] [2]) - (this.arr[2][1] * this.arr[1] [2]); else if (rowX == 1) return (this.arr[0][1] * this.arr[2][2]) - (this.arr[2][1] * this.arr[O] [2]); else if (rowX == 2) return (this.arr[0][1] * this.arr[1][2]) - (this.arr[1][1] * this.arr[0][2]); else return -1;// Error case 138 } 139 140 141 142 143 144 145 146 147 148 public boolean isSquare () { if (this.m_rows == this.n_cols) return true; else return false; } 149 150 151 152 153 154 public Matrix transpose() { Matrix result = new Matrix(this.m_rows, this.n_cols); for (int i = 0; iStep 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