Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using JAVA We are asked to design a Class called Matrix to perform some operations of elementary matrix calculation. The class contains (see UML below):

Using JAVA We are asked to design a Class called Matrix to perform some operations of elementary matrix calculation. The class contains (see UML below):  Private data: nligs, ncols, matrix.  2 constructors: o The first initializes a null matrix of nligs and ncols to zero. o The second constructs a matrix from a two-dimensional array.  Accessors and mutators for private data: nligs, ncols  A method getValueAt(int i, int j) which returns the value of the element (i,j) of the matrix.  A method setValueAt(int i, int j) which modifies the value of the element (i,j) of the matrix.  Optional: o A static method transpose(Matrix A) which returns a Matrix type object which is the transpose of matrix A. o A method multipliedBy(Matrix B) which returns a Matrix type object which is the product of the object by the matrix B.  A toString() method that replaces (override) the toString method in the class Object and prints the contents of the matrix.

image text in transcribed

An example of a test program of this class is given below (see result on the console above):

public static void main(String[] args) { double m1[][]={{1,2,3}, { 4,5,6}, {7,8,9}}; Matrice F0= new Matrice(4,4); System.out.println(F0); Matrice F1= new Matrice(m1); Matrice F2; Matrice F3; System.out.println(F1); F2=Matrice.transpose(F1); System.out.println(F2); F3=F1. multipliePar (F2); System.out.println(F3); }

D: Wava_course 1 idevhtmi>echo on D: Vava_eourse 1 s 1 idevhtmlld: D: Wava_course s11 de ht ml>cd D: hava_course 511 de book D: Java-course s1 ide book > java Matrice .. 2.60.00.0 41.6.32.6.6.6.6 1.62.63.64.65.66.67.68.69.6 14.0,32.6,50,0 52.503,0,122,6194122,6 Q: Vava_eourse 1 s 1 ide vook>pause Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started