Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i was given this template public class Matrix { // instance variables int [][] myMatrix; int row, col; // Constructor public Matrix (int[][] m) {

image text in transcribed

i was given this template

public class Matrix { // instance variables int [][] myMatrix; int row, col; // Constructor public Matrix (int[][] m) { // TODO: Fill } // toString method public String toString() { // TODO: Represent the Matrix in a String format // Hint: How is an array printed? // DO NOT print directly in this method, meaning // don't use System.out.println here } // Addition public Matrix add(Matrix m) { // TODO: Add the two matrices, store the value // in a new matrix and return that matrix } // Subtraction public Matrix sub(Matrix m) { // TODO: Subtract the two matrices, store the value // in a new matrix and return that matrix } // Matrix Multiplication public Matrix mult(Matrix m) { // TODO: Multiply the two matrices, store the value // in a new matrix and return that matrix } // Scalar Multiplication public Matrix mult(int scalar) { // TODO: Multiply the matrix with a scalar value // passed as a parameter // Store the value in a new matrix and return that matrix } // Equal public boolean equal (Matrix m) { // TODO: Test whether two matrices are equal // Return true/false } // Transpose public Matrix transpose() { // TODO: Transpose the matrix // Store the value in a new matrix and return that matrix } }
Part 2 Write Java code for the following and create a word document with the answers. Test whether or not the following are true by writing the necessary statements in the driver class 3. (rA)-rA 5. AB BA 7. A(B+C) ABAC 2, (A + B)' =A' +B' . (AB) BTAT 6. A(BC) (AB)C // Java code to verify (A+B)C -AC + Matrix anew Matrix(new int[][1(11,2),(2,0)); Matrix bnew Matrix(new int[]01((1,2), {2,0))); Matrix cnew Matrix(new int[1[1(11,2), {2,0})); System.out.println(a.add(b).mult(c)); System.out.println(a.mult(c).add(b.mult(c))); For the following, write the java code in the main method. Given A[1 -2 3 4 -1 2 -1 5 1 D--1 0 1 1 -1 0 Compute each of the following and simplify, whenever possible. If a computation is not possible, state (a) 3C - 4D (b) A - (D + 2C) (c)A- E (d) AE (e) 3BC - 4BD (f) CB + D (g) GC (h) FG (i) C2

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions