Question
public class DataEntry { private int row, column; private double value; /** * inRange (10 marks) * * @param row1 * :int - The row
public class DataEntry {
private int row, column;
private double value;
/**
* inRange (10 marks)
*
* @param row1
* :int - The row index at the starting point
*
* @param column1
* :int - The column index at the starting point
*
* @param row2
* :int - The row index at the ending point
*
* @param column2
* :int - The column index at the ending point
*
* @return true if the DataEntry object is located between row1 and row2
* (inclusive) and between column1 and column2 (inclusive)
*
* return false otherwise
*
*/
public boolean inRange(int row1, int column1, int row2, int column2) {
// To be completed
return false;
}
////////////////////////////////////////////////////////////
//////////// ////////////
////// //////
/// Do not edit the below methods ///
///// //////
//////////// ////////////
////////////////////////////////////////////////////////////
/**
* assign values to instance variables using setters
*/
public DataEntry(int r, int c, double val) {
setRow(r);
setColumn(c);
value = val;
}
/**
* assign the higher of 0 and r to row
* @param r
*/
public void setRow(int r) {
row = Math.max(0, r);
}
/**
* assign the higher of 0 and c to column
* @param c
*/
public void setColumn(int c) {
column = Math.max(0, c);
}
public void setValue(double val) {
value = val;
}
public int getRow() {
return row;
}
public int getColumn() {
return column;
}
public double getValue() {
return value;
}
////////////////////////////////////////////////////////////
/// End of DataEntry.java ///
////////////////////////////////////////////////////////////
}
Step 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