By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

error. help for solving

P: 6
hi,
i'm coding to take a input vector inputdata, and continuously find standard deviation to count how many distinct data ar available.for this i implement a small method called findk().
Expand|Select|Wrap|Line Numbers
  1.  public  int findk(Vector inputdata  ,double minSD)
  2.          {
  3.  
  4.             inputdata=new Vector();
  5.              double tolerance=0.001,thisSD;
  6.              Collections.sort(inputdata);
  7.  
  8.              if(minSD<0.0)
  9.              this.minSD =inputdata.getStandardDeviation();
  10.              inputdata d1= getHalf(1,inputdata);
  11.              inputdata d2 = getHalf(2,inputdata);
  12.              thisSD=d1.getStandardDeviation();
  13.  
  14.              if(thisSD+tolerance < minSD)
  15.              return 1 + findk(d1,thisSD);
  16.              thisSD=d2.getStandardDeviation();
  17.              if(thisSD+tolerance < minSD)
  18.                return 1 + findk(d2,thisSD);
  19.                return 0;
  20.           }
  21.  
  22.  
but the code shows the following error
Expand|Select|Wrap|Line Numbers
  1.  
  2. C:\Program Files\Java\jdk1.6.0_03\bin>javac ClusterAnalysis.java
  3. ClusterAnalysis.java:336: cannot find symbol
  4. symbol  : method getStandardDeviation()
  5. location: class java.util.Vector
  6.              this.minSD =inputdata.getStandardDeviation();
  7.                                   ^
  8. ClusterAnalysis.java:337: cannot find symbol
  9. symbol  : class inputdata
  10. location: class ClusterAnalysis
  11.              inputdata d1= getHalf(1,inputdata);
  12.              ^
  13. ClusterAnalysis.java:337: cannot find symbol
  14. symbol  : method getHalf(int,java.util.Vector)
  15. location: class ClusterAnalysis
  16.              inputdata d1= getHalf(1,inputdata);
  17.                            ^
  18. ClusterAnalysis.java:338: cannot find symbol
  19. symbol  : class inputdata
  20. location: class ClusterAnalysis
  21.              inputdata d2 = getHalf(2,inputdata);
  22.              ^
  23. ClusterAnalysis.java:338: cannot find symbol
  24. symbol  : method getHalf(int,java.util.Vector)
  25. location: class ClusterAnalysis
  26.              inputdata d2 = getHalf(2,inputdata);
  27.                             ^
  28. ClusterAnalysis.java:342: operator + cannot be applied to int,<any>
  29.              return 1 + findk(d1,thisSD);
  30.                     ^
  31. ClusterAnalysis.java:342: incompatible types
  32. found   : <nulltype>
  33. required: int
  34.              return 1 + findk(d1,thisSD);
  35.                       ^
  36. ClusterAnalysis.java:345: operator + cannot be applied to int,<any>
  37.                return 1 + findk(d2,thisSD);
  38.                       ^
  39. ClusterAnalysis.java:345: incompatible types
  40. found   : <nulltype>
  41. required: int
  42.                return 1 + findk(d2,thisSD);
  43.                         ^
  44. Note: ClusterAnalysis.java uses unchecked or unsafe operations.
  45. Note: Recompile with -Xlint:unchecked for details.
  46. 9 errors
  47.  
  48.  
Plz help me to solve this problem. Thanks in advance.
Mar 11 '09 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
Your code is quite a mess as you can tell by the error messages the compiler is showing.
Here is just one of the many errors:
You declare and initialize a Vector called inputdata. Then you call a method called getStandardDeviation() on it.The java.util.Vector class does not contain such a method.
Mar 11 '09 #2

Expert 10K+
P: 11,448
@thijo
Throw it all away, read some of Sun's tutorials and start all over; most of your errors come from the fact that 'inputdata' is the name of a parameter and you can't use that name as the name of a type again. You have confused the compiler so much that it started to make (incorrect) assumptions that made it start spitting out obscure error messages. The fist parameter of that findk method has to be of type Vector; you're passing a non-defined local variable d1 (or d2) of unknown type to it. Also read the API documentation for the Vector class and see what methods it implements; you can't simply make up some interesting names (getStandardDeviation) and hope that it's implemented by that particular class; that's not how programming works.

kind regards,

Jos
Mar 11 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.