Error: cannot find symbol - constructer IntValues()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Elaine121
    New Member
    • Aug 2007
    • 23

    Error: cannot find symbol - constructer IntValues()

    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;
    }
    }
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by Elaine121
    in my test class i get an error that says cannot find symbol - constructer IntValues()
    Yep, the compiler is right (as always): there is no constructor in that class that
    doesn't take any parameters. You wrote that class yourself, so check for yourself.

    kind regards,

    Jos

    Comment

    Working...