943,808 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 3636
  • Java RSS
Oct 31st, 2007
0

Help Java error message: cannot find symbol

Expand Post »
Theese are error i am getting .. please help..

thanks in advance

Java Syntax (Toggle Plain Text)
  1. F:\JAVA\Java Files\lab 9\MyCustomer.java:12: cannot find symbol
  2. symbol : method addaccount(Account)
  3. location: class Customer
  4. cust1.addaccount(account);
  5. ^
  6. F:\JAVA\Java Files\lab 9\MyCustomer.java:13: cannot find symbol
  7. symbol : class Savingsaccount
  8. location: class MyCustomer
  9. cust1.addAccount(new Savingsaccount(5000.0,0.05)); //saving accountNo= 2
  10. ^
  11. F:\JAVA\Java Files\lab 9\MyCustomer.java:14: cannot find symbol
  12. symbol : method addAccount(CheckingAccount)
  13. location: class Customer
  14. cust1.addAccount(new CheckingAccount(200.0,0)); //saving accountNo =3
  15. ^
  16. F:\JAVA\Java Files\lab 9\MyCustomer.java:16: cannot find symbol
  17. symbol : variable acccount
  18. location: class MyCustomer
  19. acccount = cust1.getAccount(2); //retrieve Debie savings account
  20. ^
  21. F:\JAVA\Java Files\lab 9\MyCustomer.java:22: cannot find symbol
  22. symbol : method withdraw(double)
  23. location: class MyCustomer
  24. cust1.getAccount(1); withdraw(200.0);
  25. ^
  26. F:\JAVA\Java Files\lab 9\MyCustomer.java:26: cannot find symbol
  27. symbol : method addAccount(Account)
  28. location: class Customer
  29. cust2.addAccount(account);
  30. ^
  31. F:\JAVA\Java Files\lab 9\MyCustomer.java:27: cannot find symbol
  32. symbol : method addAccount(Account)
  33. location: class Customer
  34. cust1.addAccount(account); // a joint account for jack/debie
  35. ^
  36. F:\JAVA\Java Files\lab 9\MyCustomer.java:29: cannot find symbol
  37. symbol : method withdraw(double)
  38. location: class MyCustomer
  39. cust1.getAccount(4); withdraw(20000.0);
  40. ^
  41. F:\JAVA\Java Files\lab 9\MyCustomer.java:33: cannot find symbol
  42. symbol : method addAccount(Account)
  43. location: class Customer
  44. cust3.addAccount(account);
  45. ^
  46. F:\JAVA\Java Files\lab 9\MyCustomer.java:34: cannot find symbol
  47. symbol : class Savingsaccount
  48. location: class MyCustomer
  49. cust3.addAccount(new Savingsaccount(51070.0,0.04)); //saving accountNo= 3
  50. ^
  51. F:\JAVA\Java Files\lab 9\MyCustomer.java:35: cannot find symbol
  52. symbol : method addAccount(CheckingAccount)
  53. location: class Customer
  54. cust3.addAccount(new CheckingAccount(755.0,210000.0)); //saving accountNo =4
  55. ^
  56. F:\JAVA\Java Files\lab 9\MyCustomer.java:36: cannot find symbol
  57. symbol : method deposit(double)
  58. location: class MyCustomer
  59. cust3.getAccount(5); deposit(1000.0);
  60. ^
  61. F:\JAVA\Java Files\lab 9\MyCustomer.java:37: cannot find symbol
  62. symbol : method withdraw(double)
  63. location: class MyCustomer
  64. cust3.getAccount(5); withdraw(2450.0);
  65. ^
  66. F:\JAVA\Java Files\lab 9\MyCustomer.java:41: cannot find symbol
  67. symbol : method addAccount(Account)
  68. location: class Customer
  69. cust3.addAccount(account);
  70. ^
  71. F:\JAVA\Java Files\lab 9\MyCustomer.java:42: cannot find symbol
  72. symbol : class Savingsaccount
  73. location: class MyCustomer
  74. cust3.addAccount(new Savingsaccount(5070.0,0.06)); //saving accountNo= 3
  75. ^
  76. F:\JAVA\Java Files\lab 9\MyCustomer.java:43: cannot find symbol
  77. symbol : method addAccount(CheckingAccount)
  78. location: class Customer
  79. cust3.addAccount(new CheckingAccount(700.0,45800.0)); //saving accountNo =4
  80. ^
  81. F:\JAVA\Java Files\lab 9\MyCustomer.java:44: cannot find symbol
  82. symbol : method deposit(double)
  83. location: class MyCustomer
  84. cust3.getAccount(5); deposit(1606.0);
  85. ^
  86. F:\JAVA\Java Files\lab 9\MyCustomer.java:45: cannot find symbol
  87. symbol : method withdraw(double)
  88. location: class MyCustomer
  89. cust3.getAccount(5); withdraw(1676.0);
  90. ^
  91. 18 errors
  92.  
  93. Tool completed with exit code 1

java source file

Java Syntax (Toggle Plain Text)
  1. import java.text.*;
  2.  
  3. public class MyCustomer
  4. {
  5. public static void main (String[] args)
  6. {
  7. Customer cust1, cust2, cust3, cust4;
  8. Account account;
  9.  
  10. cust1 = new Customer("Debbie gralla");
  11. account = new CheckingAccount(5000.0, 200.0); //accountNo = 1
  12. cust1.addAccount(account);
  13. cust1.addAccount(new Savingsaccount(5000.0,0.05)); //saving accountNo= 2
  14. cust1.addAccount(new CheckingAccount(200.0,0)); //saving accountNo =3
  15.  
  16. acccount = cust1.getAccount(2); //retrieve Debie savings account
  17. if (account != null)
  18. {
  19. account.deposit(500.0);
  20. }
  21.  
  22. cust1.getAccount(1); withdraw(200.0);
  23.  
  24. cust2 = new Customer("Jack leu");
  25. account = new CheckingAccount(500.0,20000.0); //accountno =4
  26. cust2.addAccount(account);
  27. cust1.addAccount(account); // a joint account for jack/debie
  28.  
  29. cust1.getAccount(4); withdraw(20000.0);
  30.  
  31. cust3 = new Customer("Jill bye");
  32. account = new CheckingAccount(755.0,210000.0); //accountno =5
  33. cust3.addAccount(account);
  34. cust3.addAccount(new Savingsaccount(51070.0,0.04)); //saving accountNo= 3
  35. cust3.addAccount(new CheckingAccount(755.0,210000.0)); //saving accountNo =4
  36. cust3.getAccount(5); deposit(1000.0);
  37. cust3.getAccount(5); withdraw(2450.0);
  38.  
  39. cust4 = new Customer("jeena naik");
  40. account = new CheckingAccount(18755.0,23000.0); //accountno =5
  41. cust4.addAccount(account);
  42. cust4.addAccount(new Savingsaccount(5070.0,0.06)); //saving accountNo= 3
  43. cust4.addAccount(new CheckingAccount(700.0,45800.0)); //saving accountNo =4
  44. cust4.getAccount(5); deposit(1606.0);
  45. cust4.getAccount(5); withdraw(1676.0);
  46. }
  47.  
  48. }
[c
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
java_starter is offline Offline
15 posts
since Sep 2007
Oct 31st, 2007
0

Re: Help Java error message: cannot find symbol

Cannot find symbol means that it can't find a class,method, or variable that you have used. It could be that you misspelled something (watch capitalization, Java is case sensitive) or you are calling a method that does not exist on that class.

These are very basic error messages. Look at each one and read it, then look at the line number that it tells you the error occurred on and fix it.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007
Oct 31st, 2007
0

Re: Help Java error message: cannot find symbol

Click to Expand / Collapse  Quote originally posted by Ezzaral ...
Cannot find symbol means that it can't find a class,method, or variable that you have used. It could be that you misspelled something (watch capitalization, Java is case sensitive) or you are calling a method that does not exist on that class.

These are very basic error messages. Look at each one and read it, then look at the line number that it tells you the error occurred on and fix it.

I did go over the entire program and no luck solving the error. and ever thing is spelled right. so what could be the errors for.. please let me know

thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
java_starter is offline Offline
15 posts
since Sep 2007
Nov 1st, 2007
0

Re: Help Java error message: cannot find symbol

he explained it.
You either use a variable or method that you forgot to declare or you made an error in the declaration.
The latter can typically be a typo or a scope error (declaring it somewhere where it's not visible from the place you're calling it).
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Nov 1st, 2007
0

Re: Help Java error message: cannot find symbol

Look in your Customer class. Either it doesn't contain any addAccount/withdraw/deposit methods or you may have declared those methods all private.
Reputation Points: 92
Solved Threads: 51
Practically a Posting Shark
Phaelax is offline Offline
856 posts
since Mar 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: JFileChooser timeout / thread problems
Next Thread in Java Forum Timeline: How to solve in Mysql





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC