Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago