Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions