Question: public interface Matrices { / * Adds two matrices and returns the result as a new matrix. @param m 1 - matrix 1 param m

public interface Matrices {
/*
Adds two matrices and returns the result as a new matrix.
@param m1- matrix 1
param m1- matrix 2
@return - the addition of the two matrices
@throws an illegalArgumentException if the sizes of n1, m2 are illegal for addition
*/
public Integer[][] addMatrices(Integer[][] m1, Integer[][] m2);
/*
Multiples two matrices and returns the result as a new matrix.
@param m1- matrix 1
param m1- matrix 2
@return - the addition of the two matrices
@throws an illegalArgumentException if the sizes of n1, m2 are illegal for multiplication
*/
public Integer[][] multiplyMatrices(Integer[][] m1, Integer[][] m2);
}public class MathOperations implements Matrices {
private Integer[][] A; //matrix A
private Integer[][] B; //matrix B
private Integer[][] c; //A + B OR A X B, the resulting matrix
/**
* Get the value of c
*
* @return the value of c
*/
public Integer[][] getC(){
return c;
}
/**
* Set the value of c
*
* @param c new value of c
*/
public void setC(Integer[][] c){
this.c = c;
}
/**
* Get the value of B
*
* @return the value of B
*/
public Integer[][] getB(){
return B;
}
/**
* Set the value of B
*
* @param B new value of B
*/
public void setB(Integer[][] B){
this.B = B;
}
/**
* Get the value of A
*
* @return the value of A
*/
public Integer[][] getA(){
return A;
}
/**
* Set the value of A
*
* @param A new value of A
*/
public void setA(Integer[][] A){
this.A = A;
}
/**
* Adds two matrices and returns the result as a new matrix.
*
* @param m1- matrix 1
* @param m2- matrix 2
* @return - the addition of the two matrices
* @throws an IllegalArgumentException if the sizes of n1, m2 are illegal
* for addition
*
*
*
*/
@Override
public Integer[][] addMatrices(Integer[][] m1, Integer[][] m2){
}
/*
Multiples two matrices and returns the result as a new matrix.
@param m1- matrix 1
@param m2- matrix 2
@return - the addition of the two matrices
@throws an illegalArgumentException if the sizes of n1, m2 are illegal for multiplication
*/
@Override
public Integer[][] multiplyMatrices(Integer[][] m1, Integer[][] m2){
}@Named(value = "matriceBean")
@SessionScoped
public class MatriceBean implements Serializable {
private Integer rowsA;
private Integer columnsA;
private Integer rowsB;
private Integer columnsB;
MathOperations matrices = new MathOperations();
public MathOperations getMatrices(){
return matrices;
}
/**
* Get the value of columnsB
*
* @return the value of columnsB
*/
public Integer getColumnsB(){
System.out.println("getColumnsB()");
return columnsB;
}
/**
* Set the value of columnsB
*
* @param columnsB new value of columnsB
*/
public void setColumnsB(Integer columnsB){
System.out.println("setColumnsB"+ columnsB);
this.columnsB = columnsB;
}
/**
* Get the value of rowsB
*
* @return the value of rowsB
*/
public Integer getRowsB(){
System.out.println("getRowsB()");
return rowsB;
}
/**
* Set the value of rowsB
*
* @param rowsB new value of rowsB
*/
public void setRowsB(Integer rowsB){
System.out.println("setRowsB"+ rowsB);
this.rowsB = rowsB;
}
/**
* Get the value of columnsA
*
* @return the value of columnsA
*/
public Integer getColumnsA(){
System.out.println("getColumnsA()");
return columnsA;
}
/**
* Set the value of columnsA
*
* @param columnsA new value of columnsA
*/
public void setColumnsA(Integer columnsA){
System.out.println("setColumnsA"+ columnsA);
this.columnsA = columnsA;
}
/**
* Get the value of rowsA
*
* @return the value of rowsA
*/
public Integer getRowsA(){
System.out.println("getRowsA()");
return rowsA;
}
/**
* Set the value of rowsA
*
* @param rowsA new value of rowsA
*/
public void setRowsA(Integer rowsA){
System.out.println("setRowsA"+ rowsA);
this.rowsA = rowsA;
}
/**
* Creates a new instance of MatriceBean
*/
public MatriceBean(){// how do we now the size of the matrix
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!