Question
Develop a program (name it AddMatrices) that adds two matrices. The matrices must of the same size. The program defines method Addition () that takes
Develop a program (name it AddMatrices) that adds two matrices. The matrices must of the same size. The program defines method Addition() that takes two two-dimensional arrays of integers and returns their addition as a two-dimensional array. The program main method defines two 3-by-3 arrays of type integer. The method prompts the user to initialize the arrays. Then it calls method Addition(). Finally, it prints out the array retuned by method Addition(). Document your code, and organize and space the outputs properly as shown below.
Sample run 1:
Matrix A:
2 1 2
7 1 8
3 20 3
Matrix B:
1 1 1
1 1 1
1 1 1
A + B:
3 2 3
8 2 9
4 21 4
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