Question: Java Create a new class called Matrix which: Has a private 2-dimensional array to store double values A constructor which takes in the number of

Java Java Create a new class called Matrix which: Has a private 2-dimensional

Create a new class called Matrix which:

Has a private 2-dimensional array to store double values

A constructor which takes in the number of rows and columns the matrix should have, and creates a 2D array with the same number of rows & columns, and initializes all its values to 0

Create a get function, which takes in the row and column numbers, and returns the value stored at that position

Create a set function, which takes in the row and column numbers and a value, and sets the value at the specified position to the given value

Create a toString() method which returns a string representation of the matrix

- One row per line

- Tab separated (or similar) for each column within the row

-Try to make it look good for varying sizes, consider using String.format here

Create a main method, in another file, to test your Matrix class

- Create a new class called Matrix which: - Has a private 2-dimensional array to store double values - A constructor which takes in the number of rows and columns the matrix should have, and creates a 2D array with the same number of rows \& columns, and initializes all its values to 0 - Create a get function, which takes in the row and column numbers, and returns the value stored at that position - Create a set function, which takes in the row and column numbers and a value, and sets the value at the specified position to the given value - Create a toString () method which returns a string representation of the matrix - One row per line - Tab-separated (or similar) for each column within the row - Try to make it look good for varying sizes, consider using String. format here - Create a main method, in another file, to test your Matrix class

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 Databases Questions!