Create a matrix calculator with this template.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a matrix calculator with this template.

 

import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
public class Main {
private static final int DIMENSION = 3;
/**
* Parses a matrix from a string.
* @param s The string to parse. It must
* The amount of numbers should be equal to {@code rowCount * columnCount}.
* @param rowCount the number of rows in the matrix.
}
/* aim for 3 x 3 matrix: 3 rows and 3 columns */
* @param colCount the number of columns in the matrix.
* @return The matrix represented by the string.
*/
private static int[][] parseMatrix(String s, int rowCount, int colCount) {
/* fill in here */
consist only of numbers separated by spaces.
}
return null; /* change this! return a 2D int[][] variable*/
/**
* Returns the matrix which is the result of the operation {@code op} on the
* matrices {@code a} and {@code b}.
* @param a The first matrix.
* @param b The second matrix.
* @param op The operation to perform. Must be one of {@code +}, {@code -}, {@code *}.
* @return The matrix which is the result of the operation.
*/
private static int[][] computeMatrixExpression (int[][] a, int[][] b, String op) {
/* fill in here */
return null; /* change this! return a 2D int[][] variable */
/**
* Converts a matrix to a string. For a given matrix
* {@code [[¹, 2, 3], [4, 5, 6], [7, 8, 9]]}, the string representation will be
* {@code "[1 2 3]\n[4 5 6]\n [7 8 9]"}.
*
* @param mat The matrix to convert.
* @return The string representation of the matrix.
*/
private static String matrixToString(int[][] mat) {
/* fill in here */
return null; /* change this! return a String */
Transcribed Image Text:import java.util.Arrays; import java.util.Objects; import java.util.Scanner; import java.util.StringJoiner; public class Main { private static final int DIMENSION = 3; /** * Parses a matrix from a string. * @param s The string to parse. It must * The amount of numbers should be equal to {@code rowCount * columnCount}. * @param rowCount the number of rows in the matrix. } /* aim for 3 x 3 matrix: 3 rows and 3 columns */ * @param colCount the number of columns in the matrix. * @return The matrix represented by the string. */ private static int[][] parseMatrix(String s, int rowCount, int colCount) { /* fill in here */ consist only of numbers separated by spaces. } return null; /* change this! return a 2D int[][] variable*/ /** * Returns the matrix which is the result of the operation {@code op} on the * matrices {@code a} and {@code b}. * @param a The first matrix. * @param b The second matrix. * @param op The operation to perform. Must be one of {@code +}, {@code -}, {@code *}. * @return The matrix which is the result of the operation. */ private static int[][] computeMatrixExpression (int[][] a, int[][] b, String op) { /* fill in here */ return null; /* change this! return a 2D int[][] variable */ /** * Converts a matrix to a string. For a given matrix * {@code [[¹, 2, 3], [4, 5, 6], [7, 8, 9]]}, the string representation will be * {@code "[1 2 3]\n[4 5 6]\n [7 8 9]"}. * * @param mat The matrix to convert. * @return The string representation of the matrix. */ private static String matrixToString(int[][] mat) { /* fill in here */ return null; /* change this! return a String */
}
/* fill in here */
}
/* main method. */
public static void main(String[] args) {
/* fill in here. Use the flow chart to lay out your plan! */
}
return null; /* change this! return a String */
Transcribed Image Text:} /* fill in here */ } /* main method. */ public static void main(String[] args) { /* fill in here. Use the flow chart to lay out your plan! */ } return null; /* change this! return a String */
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Potential Method of Analysis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education