Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a java program named Matrix.java including the following methods: 1. [7 marks] Write a method named genMatrix that given, m, the number of
Write a java program named Matrix.java including the following methods: 1. [7 marks] Write a method named genMatrix that given, m, the number of rows and columns initializes and returns a matrix with random positive double values less than 100. 2. [7 marks] Write a method named printMatrix that given a matrix of m rows and m columns of doubles, prints it in a tabular format with 2 digits after decimal point. 3. [7 marks] Write a method named isSymmetric that given a matrix checks whether it is symmetric. A matrix, M, is symmetric if for every index of i and j the M[i][j] is equal to M[j][U]. 4. [7 marks] Write a method named Multiply that given a double coefficient c and a matrices of m rows and m columns of doubles, calculates and returns cxM1. The original matrix should not be changed. cx M1 = M where M[i][j] =cx M1[0][], For more information, check this. 5. [4 marks-bonus marks - optional] Write a method named Square that given a matrices of n rows and n columns of doubles, calculates, and returns the square of the given matrix. The original matrix should not be changed. M1 x M2 = M where M[i][i] = 1 M1[i][k] x M2[k]], For more info, check this. 6. [7 marks] Write a main method that shows a menu like the following for choosing an operation and shows the result accordingly. M is a matrix with random positive double values less than 100. Choose one of the following options to resume the program: 1: Create M 2: Display M 3: Square M 4 Multiply M with a coefficient Check whether M is symmetric 5 6 Quit the program
Step by Step Solution
★★★★★
3.34 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
import javautilRandom import javatextDecimalFormat import javautilScanner public class Matrix private double matrix private int rows private int colum...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