The Class has no error, but the test program has a constructor error on line 21.
/**
* DataSet Class
*
* @version 10/3/11
*/
public class DataSet
{
private int Sum;
private double Average;
private int Largest;
private int Smallest;
public DataSet(int Sum,int Largest,int Smallest, double Average)
{
Sum = 0;
Average = 0;
Largest = Integer.MIN_VALUE;
Smallest = Integer.MAX_VALUE;
}
public void addValue(int x)
{
Sum = x+Sum;
Average = (Average+x)/2;
if (x < Smallest)
{
Smallest = x;
}
if (x > Largest)
{
Largest = x;
}
}
public int getSum()
{
return Sum;
}
public int getLargest()
{
return Integer.MAX_VALUE;
}
public int getSmallest()
{
return Integer.MIN_VALUE;
}
public double getAverage()
{
return Average;
}
}
The Test Program
/**
* DataSet Test Program
*
* @version 10/3/11
*/
import java.util.Scanner;
public class DataSetTest
{
public static void main(String [] args)
{
int x;
Scanner myScanner = new Scanner(System.in);
System.out.println("Input a value: ");
String answer = myScanner.nextLine();
x = Integer.parseInt(answer);
DataSet myData = new DataSet(x);
System.out.println("The Sum is "+ myData.findSum());
System.out.println("The Average is "+ myData.findAverage());
System.out.println("The Smallest number is "+ myData.findSmallest());
System.out.println("The Largest number is "+ myData.findLargest());
}
}