Y would something compile from a hard drive fine but from on a disk?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2004
Posts: 2
Reputation: KCC1982 is an unknown quantity at this point 
Solved Threads: 0
KCC1982 KCC1982 is offline Offline
Newbie Poster

Y would something compile from a hard drive fine but from on a disk?

 
0
  #1
Sep 25th, 2004
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);

}
}
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 84
Reputation: jerbo is an unknown quantity at this point 
Solved Threads: 1
jerbo jerbo is offline Offline
Junior Poster in Training

Re: Y would something compile from a hard drive fine but from on a disk?

 
0
  #2
Sep 27th, 2004
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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 153
Reputation: cosi is an unknown quantity at this point 
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: Y would something compile from a hard drive fine but from on a disk?

 
0
  #3
Oct 8th, 2004
It looks like you renamed the class. Either change all references to DataSet to DataSet3 -OR- change all DataSet3 to DataSet

  1. //Make it like this:
  2. class DataSet
  3. {
  4. public DataSet()
  5. .....
  6.  
  7. }


Originally Posted by KCC1982
class DataSet3
{
public DataSet3()
.....

}
In a world without walls or fences,
What use are Windows and Gates.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC