Question: So theres a line in my code that wont work for when i create a set method.. this is the constructor public DataEntry(int r, int

So theres a line in my code that wont work for when i create a set method.. this is the constructor

public DataEntry(int r, int c, double val) {

setRow(r);

setColumn(c);

value = val;

}

but when i run the code, the line that doesnt work says that the constructor DataEntry() is undefined, HELP!

/**

* set the value of DataEntry object at given row and column to given value

*

* if a DataEntry object for given row and column already exists, overwrite the current value

* if a DataEntry object for given row and column doesn't exist, add a new DataEntry object

* with given row, column, value to the list.

* @param row

* @param column

* @param val

*/

public void set(int row, int column, double val) {

boolean isNew = true;

for (DataEntry dataEntry : data) {

if (dataEntry.getColumn() == column && dataEntry.getRow() == row) {

dataEntry.setValue(val);

isNew = false;

}

}

if (isNew) {

line wont work... DataEntry newData = new DataEntry();

newData.setColumn(column);

newData.setRow(row);

newData.setValue(val);

data.add(newData);

}

}

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!