Hi,
The following code compiles and runs fine from the hard drive but does not compile fine from a floppy disk. It gives me a cannot resolve symbol error for the DataSet dataSet = new DataSet(); line. Any ideas? The program is supposed to except user input for 4 integers and display the smallest and the largest of the 4. It does that fine from the hard drive.

class DataSet3
{
        private int smallest;
        private int largest;
        private int value1;
        private int value2;
        private int value3;
        private int value4;

        //The constructor

        public DataSet3()
        {
            smallest = 0;
            largest = 0;
        }

        public void addValue(int whatvalue1, int whatvalue2, int whatvalue3, int whatvalue4)
        {
            value1 = whatvalue1;
            value2 = whatvalue2;
            value3 = whatvalue3;
            value4 = whatvalue4;    
        }

        public int getSmallest()
        {
        int min12 = Math.min(value1, value2);
        int min34 = Math.min(value3, value4);

            return Math.min(min12, min34);
        }

        public int getLargest()
        {
        int max12 = Math.max(value1, value2);
        int max34 = Math.max(value3, value4);

            return Math.max(max12, max34);

        }
}


import javax.swing.JOptionPane;

class DataSetTest3
{
    public static void main(String[] args)
    {

        int number1 = 0, number2 = 0, number3 = 0, number4 = 0;
        String value=" "; 

        value = JOptionPane.showInputDialog("Please Enter Number 1:"); 
        number1 = Integer.parseInt(value); 

        value = JOptionPane.showInputDialog("Please Enter Number 2:"); 
        number2 = Integer.parseInt(value); 

        value = JOptionPane.showInputDialog("Please Enter Number 3:"); 
        number3 = Integer.parseInt(value); 

        value = JOptionPane.showInputDialog("Please Enter Number 4:"); 
        number4 = Integer.parseInt(value); 

        DataSet dataSet = new DataSet();
        dataSet.addValue(1, number1);
        dataSet.addValue(2, number2);
        dataSet.addValue(3, number3);
        dataSet.addValue(4, number4);

        System.out.println("The smallest number is " +dataSet.getSmallest());
        System.out.println("The largest number is  " +dataSet.getLargest());

        System.exit(0);

    }
}

Where is your Dataset() method defined? Are you including this class on your floppy? I ask because I don't see it (Dataset) defined, or included in your code above.

I assume you are compiling on a different PC?

It looks like you renamed the class. Either change all references to DataSet to DataSet3 -OR- change all DataSet3 to DataSet

//Make it like this:
class DataSet
{
     	public DataSet()
        .....

}

class DataSet3
{
public DataSet3()
.....

}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.