Question
JAVA PROBLEM COLLECTIONS This is the code: I will copy and paste it down the bottom too so it can be easily copied. package coll.Matrix;
JAVA PROBLEM COLLECTIONS
This is the code: I will copy and paste it down the bottom too so it can be easily copied.
package coll.Matrix;
import java.util.*;
public class Matrix implements Iterable {
/**
* Construct a Matrix object.
*
* @param rows. An int that specifies the number of rows.
* @param columns. An int that specifies the number of columns.
*/
public Matrix() {
}
/**
* Assigns a value to a given cell, specified by its row, column coordinates.
*
* @param row. An int for the row index with 0-based indexing.
* @param column. An int for the column index with 0-based indexing.
* @param value. A generic value to be assigned to the given cell.
*/
public insert() {
}
/**
* Gets the value at a given cell, specified by its row, column coordinates.
* @param row. An int for the row index with 0-based indexing.
* @param column. An int for the column index with 0-based indexing.
* @return value. A generic value located at the given cell.
*/
public get() {
}
/**
* Gets the total number of cells in the matrix.
* @return an int equal to the total number of cells in the matrix.
*/
public size() {
}
/**
* Converts the matrix to String format.
* @return a String representation of the matrix.
*/
public toString() {
}
/**
* Returns an Iterator object for the matrix. The Iterator should follow the
* order of row by row. Within each row the order is left to right.
* @return an Iterator object for the matrix.
*/
public Iterator iterator() {
}
}
Requirements A matrix is a rectangular array of values arranged in rows and columns. For example You are to implement a new collection, a Matrix. Ordinarily, new collections would implement the Collection interface, but for the purpose of this exercise, we will not do this so as to avoid implementing the eleven additional methods as part of the interface's contract However, because all collections can be instantiated with any type, your Matrix class will need to be "generic". Therefore, the tests for this exercise will attempt to instantiate and test your Matrix class using both Integer and String cell values (in separate unit tests) The provided skeleton will help you get started. The first step is to fix the current compiler errors by inserting the correct return types and parameters for each method (and constructor) according to the JavaDoc comments. Eclipse will help you with this process via suggestions. The next step is figuring out how you will internally model the Matrix. Look into Collection types that currently exist and think about how you can use them and their methods as a backbone for the classStep 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