Help Java error message: cannot find symbol

Reply

Join Date: Sep 2007
Posts: 15
Reputation: java_starter is an unknown quantity at this point 
Solved Threads: 0
java_starter java_starter is offline Offline
Newbie Poster

Help Java error message: cannot find symbol

 
0
  #1
Oct 31st, 2007
Theese are error i am getting .. please help..

thanks in advance

  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

  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
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,425
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 507
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Help Java error message: cannot find symbol

 
0
  #2
Oct 31st, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 15
Reputation: java_starter is an unknown quantity at this point 
Solved Threads: 0
java_starter java_starter is offline Offline
Newbie Poster

Re: Help Java error message: cannot find symbol

 
0
  #3
Oct 31st, 2007
Originally Posted by Ezzaral View Post
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,144
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Help Java error message: cannot find symbol

 
0
  #4
Nov 1st, 2007
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).
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 763
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: Help Java error message: cannot find symbol

 
0
  #5
Nov 1st, 2007
Look in your Customer class. Either it doesn't contain any addAccount/withdraw/deposit methods or you may have declared those methods all private.
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC