Hi i'm writing a program where you have to determine the smallest, number of distinctions and the average from an array of values.
in my test class i get an error that says cannot find symbol - constructer IntValues()
here is my program:
public class IntValuesTest
{
public static void main(String args[])
{
int valueNum[] = {45, 84, 56, 79, 63, 92, 76, 54, 61, 72};
IntValues myValues = new IntValues();
System.out.prin tln("Smallest value: " + myValues.getSma ll());
System.out.prin tln("number of distinctions: " + myValues.GetDis t());
System.out.prin tln("average : " + myValues.getAvg ());
}
}
here is my class:
public class IntValues
{
private int smallest;
private int values[];
public IntValues(int small, int val[])
{
smallest = small;
values = val;
}
public int getSmall()
{
int low = values[0];
for (int value : values)
{
if (value < low)
low = value;
}
return low;
}
public int GetDist()
{
int distinction = 0;
for ( int num = 0; num < values.length; num++)
{
if (num >= 75)
distinction = distinction + 1;
}
return distinction;
}
public int getAvg()
{
int total = 0;
for ( int num = 0; num < values.length; num++)
{
total += num;
}
return total / values.length;
}
}
in my test class i get an error that says cannot find symbol - constructer IntValues()
here is my program:
public class IntValuesTest
{
public static void main(String args[])
{
int valueNum[] = {45, 84, 56, 79, 63, 92, 76, 54, 61, 72};
IntValues myValues = new IntValues();
System.out.prin tln("Smallest value: " + myValues.getSma ll());
System.out.prin tln("number of distinctions: " + myValues.GetDis t());
System.out.prin tln("average : " + myValues.getAvg ());
}
}
here is my class:
public class IntValues
{
private int smallest;
private int values[];
public IntValues(int small, int val[])
{
smallest = small;
values = val;
}
public int getSmall()
{
int low = values[0];
for (int value : values)
{
if (value < low)
low = value;
}
return low;
}
public int GetDist()
{
int distinction = 0;
for ( int num = 0; num < values.length; num++)
{
if (num >= 75)
distinction = distinction + 1;
}
return distinction;
}
public int getAvg()
{
int total = 0;
for ( int num = 0; num < values.length; num++)
{
total += num;
}
return total / values.length;
}
}
Comment