B
big dan
I need some help. Here's some code for some work I have to do:
/*DataSet.java defines a class of DataPoint objects. These objects
*maintain a collection of DataPoint objects and
*contain various methods which enable the DataSet object to
*show certain behaviours*/
class DataSet
{
//* instance variables********************************************
//DataPoint dp = new DataPoint();
private DataPoint[] data;
private static final int MAXNUMDATAPOINTS= 5;
private int numDataPoints;
private int length;
private String marker;
/*other private variables*****************************************/
private String maxMark ="<<<<Max";
private String minMark ="<<<<Min";
private String foundMark ="<<<<found";
/*constructor********************************************************/
private
void init()
{
DataPoint = new int[MAXNUMDATAPOINTS];
}
public
DataSet() // no arguments
{
numDataPoints = MAXNUMDATAPOINTS;
init();
}
/* methods needed to implement behaviours of the
object******************/
/*addDataPoint() enables a Datapoint to be added to the
collection****/
public boolean addDataPoint(DataPoint dp)
{
if (length == MAXNUMDATAPOINTS )
return false;
sp.marker[length] = new DataPoint (dp);
length ++;
return true;
/*these methods change the value of the marker attribute of DataPoint
to one of the appropriate strings e.g. "<<<<max"*/
public void markMaxY()
{
}
public void markMinY()
{
}
/*displayAll(boolean show) if true returns a string showing the full
contents of the collection if false the string only contains x and y
values*/
public String displayAll(boolean show)
{
if (show = false);
return true
if (show = true);
}
/* changeValues enables the values of a data pair specified by its
index in the collection to be changed */
//public void changeValues(int index, int xvalue, int yvalue)
/* reader methods**********************************************/
public int getMAXNUMDATAPOINTS()
{
return MAXNUMDATAPOINTS;
}
public int getnumDataPoints()
{
return numDataPoints;
}
/* writer methods**********************************************/
public void setX(int index, int xvalue)
{
setXindex = index;
setXvalue = xvalue;
}
public void setY(int index, int yvalue)
{
setYindex = index;
setYvalue = yvalue;
}
//*toString(int i) returns a string holding the x and y values of one
data pair
public String toString(int i)
{
String i = xvalue + yvalue;
return i;
}
/* findAverageY()returns the average of y values as a double */
public double findAverageY()
{
}
/* findGreaterThan(int value) returns a String containing all data
pairs where the
* y value is greater than value. Use for Menu item 7 */
//public String findGreaterThan(int value)
/*other methods You may place your own methods here
***************************/
}
}
/*DataSet.java defines a class of DataPoint objects. These objects
*maintain a collection of DataPoint objects and
*contain various methods which enable the DataSet object to
*show certain behaviours*/
class DataSet
{
//* instance variables********************************************
//DataPoint dp = new DataPoint();
private DataPoint[] data;
private static final int MAXNUMDATAPOINTS= 5;
private int numDataPoints;
private int length;
private String marker;
/*other private variables*****************************************/
private String maxMark ="<<<<Max";
private String minMark ="<<<<Min";
private String foundMark ="<<<<found";
/*constructor********************************************************/
private
void init()
{
DataPoint = new int[MAXNUMDATAPOINTS];
}
public
DataSet() // no arguments
{
numDataPoints = MAXNUMDATAPOINTS;
init();
}
/* methods needed to implement behaviours of the
object******************/
/*addDataPoint() enables a Datapoint to be added to the
collection****/
public boolean addDataPoint(DataPoint dp)
{
if (length == MAXNUMDATAPOINTS )
return false;
sp.marker[length] = new DataPoint (dp);
length ++;
return true;
/*these methods change the value of the marker attribute of DataPoint
to one of the appropriate strings e.g. "<<<<max"*/
public void markMaxY()
{
}
public void markMinY()
{
}
/*displayAll(boolean show) if true returns a string showing the full
contents of the collection if false the string only contains x and y
values*/
public String displayAll(boolean show)
{
if (show = false);
return true
if (show = true);
}
/* changeValues enables the values of a data pair specified by its
index in the collection to be changed */
//public void changeValues(int index, int xvalue, int yvalue)
/* reader methods**********************************************/
public int getMAXNUMDATAPOINTS()
{
return MAXNUMDATAPOINTS;
}
public int getnumDataPoints()
{
return numDataPoints;
}
/* writer methods**********************************************/
public void setX(int index, int xvalue)
{
setXindex = index;
setXvalue = xvalue;
}
public void setY(int index, int yvalue)
{
setYindex = index;
setYvalue = yvalue;
}
//*toString(int i) returns a string holding the x and y values of one
data pair
public String toString(int i)
{
String i = xvalue + yvalue;
return i;
}
/* findAverageY()returns the average of y values as a double */
public double findAverageY()
{
}
/* findGreaterThan(int value) returns a String containing all data
pairs where the
* y value is greater than value. Use for Menu item 7 */
//public String findGreaterThan(int value)
/*other methods You may place your own methods here
***************************/
}
}