Question
Assignment is designed to develop your ability to create static methods and manipulate 1D and 2D arrays in Java. Create a single Java class Matrix
Assignment is designed to develop your ability to create static methods and manipulate 1D and 2D arrays in Java.
Create a single Java class Matrix and inside the class create the specified static methods as described
Task # Description
1 Create a matrix (known components)
2 Create a matrix (random components)
3 Create a matrix from vectors
4 Compare two matrices
5 Add two matrices
6 Subtract two matrices
7 Multiply a matrix by a scalar
8 Multiply two matrices
9 Transpose a matrix
10 Determine if a matrix is symmetric
11 Determine the Trace of a Matrix
12 Calculate the Determinant of a Matrix
TASK #1
Create a static method that accepts 9 integer parameters and returns a 2D integer array containing the parameters as elements in the array. Numbers should be assigned indexes in row order [0][0]...[0][1]...etc.
TASK #2
Create a static method that accepts no parameters and returns a 2D integer array containing randomly-generated values between 0 and 9. Numbers should be assigned indexes in row order [0][0]...[0][1]...etc.
TASK #3
Create a static method that accepts 3 1D integer (length 3) arrays as parameters and returns a 2D integer array containing the 1D arrays as rows in the 2D array.
TASK #4
Create a static method that accepts 2 2D integer arrays as parameters and compares the arrays to determine if they are the same. Returns true if the arrays are the same (element by element comparison) and false otherwise.
TASK #5
Create a static method that accepts 2 2D integer arrays as parameters and adds one array to the other. Returns a new 2D array which is the result of the addition.
TASK #6
Create a static method that accepts 2 2D integer arrays as parameters and subtracts one array from the other. Returns a new 2D array which is the result of the subtraction.
TASK #7
Create a static method that accepts a 2D integer as parameters and multiplies the (scalar). Returns a new 2D array which is multiplication.
TASK #8
Create a static method that accepts two 2D integer array as parameters and multiplies the arrays. Returns a new 2D array which is the product of the multiplication.
TASK #9
Create a static method that accepts a 2D integer array as its parameter. Returns a new 2D array with rows from the parameter array as columns and columns from the parameter array as rows in the returned array.
TASK #10
Create a static method that accepts a 2D integer array as its parameter. Returns true if the transpose of the array ( see slide 15 ) is equal to the parameter array (element by element comparison) and false otherwise.
TASK #11
Create a static method that accepts a 2D integer array as its
parameter. Returns an integer which is known as the trace...
calculated as shown below:
1 2 3
4 5 6
7 8 9
The trace (an integer value) is calculated by summing the values where the index i and j values are equal [0][0], [1][1]...etc. 1+ 5+ 9 = 15
TASK #12
Create a static method that accepts a 2D integer array as its parameter. Returns an integer which is known as the determinant...calculated as shown below
The determinant (an integer value) is calculated by:
a b c
d e f
g h i
(a x e x i) + (b x f x g) + (c x d x h) (c x e x g) (bx d x i) (a x f x h)
Step 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