Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Intro to Java Project 2: Enter the Matrix Background Matrices (singular: Matrix) are very useful constructs in mathematics. They allow large amounts of numbers to
Intro to Java Project 2: Enter the Matrix Background Matrices (singular: Matrix) are very useful constructs in mathematics. They allow large amounts of numbers to be operated on very quickly. Computer algorithms use matrices a lot when multiplying large amounts of numbers. Matrices allow modern computer hardware to multiply lots of numbers simultaneously, which was not really possible a few years ago, unless you had a supercomputer. Matrices + modern hardware allow today's computers to analyze huge amounts of data, which they can learn from. This is the foundation of practical machine learning and artificial intelligence today. So, the next time you ask Alexa what the temperature is, remember that it wouldn't be possible without matrices! | 6 4 247 (1 -9 8 ) a 2x3 (2 row, 3 column) matrix Exercise If you didn't know what a matrix was until today, start by looking over this webpage for more background. Once you want to get started with the project, open Project2.java in your Cloud Shell. Inside, you will see two methods that are already done for you: - private static int[][] getMatrixFromUser() - Asks the user to enter a matrix, and returns the entered matrix as a 2D array of ints. Remember, when testing your program, if you enter '3 4' for the matrix's dimensions, you need to enter a matrix that has 3 rows and 4 columns. private static void printMatrix(int[][] mat) - Prints the given matrix out to the user. This method is provided so you don't need to worry about looping and printing the values out properly. - private static void printMatrix(int[][] mat) - Prints the given matrix out to the user. This method is provided so you don't need to worry about looping and printing the values out properly. Inside the main method, the program already calls getMatrixFromUser() and saves the matrix to a 2D array called mat. It is your job to do the following: 1. Print the transpose of mat. The transpose of a matrix is a matrix where all of the rows of the original matrix are the columns of the transpose, and all of the columns of the original are the rows of the transpose. Check out this webpage for more info. Here are some more examples from Wikipedia. 2. Print the negative of mat. The negative of a matrix is a matrix where each value is multiplied by -1. You can read more about negatives on this page 3. Print the product when multiplying mat by 3. To do this, multiply each value in the matrix by 3, and print the resulting matrix. NOTE: For each of the tasks (1-3) you should start with the original matrix that the user gave. If you use the result from the previous task, your program will be considered incorrect! Sample Output stephen anthony ellis@cloudshell:codes javac Project2.java stephen anthony ellis@cloudshell:~/Codes java Project2 Enter the dimensions of the matrix (rows and then columns): 2 3 Enter the matrix: 1 2 3 4 5 6 Here is the transpose of your matrix: 1 4 2 5 3 6 Here is the negative of your matrix: -1 -2 -3 -4 -5 -6 Here is the product of your matrix times 3: 3 6 9 12 15 18 stephen_anthony_ellis@cloudshell:-/codes |
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