DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   Help Java error message: cannot find symbol (http://www.daniweb.com/forums/thread94999.html)

java_starter Oct 31st, 2007 6:53 pm
Help Java error message: cannot find symbol
 
Theese are error i am getting .. please help..

thanks in advance

F:\JAVA\Java Files\lab 9\MyCustomer.java:12: cannot find symbol
symbol  : method addaccount(Account)
location: class Customer
                cust1.addaccount(account);
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:13: cannot find symbol
symbol  : class Savingsaccount
location: class MyCustomer
                cust1.addAccount(new Savingsaccount(5000.0,0.05));  //saving accountNo= 2
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:14: cannot find symbol
symbol  : method addAccount(CheckingAccount)
location: class Customer
                cust1.addAccount(new CheckingAccount(200.0,0));  //saving accountNo =3
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:16: cannot find symbol
symbol  : variable acccount
location: class MyCustomer
                acccount = cust1.getAccount(2);  //retrieve Debie savings account
                ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:22: cannot find symbol
symbol  : method withdraw(double)
location: class MyCustomer
                cust1.getAccount(1); withdraw(200.0);
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:26: cannot find symbol
symbol  : method addAccount(Account)
location: class Customer
                cust2.addAccount(account);
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:27: cannot find symbol
symbol  : method addAccount(Account)
location: class Customer
                cust1.addAccount(account);            // a joint account for jack/debie
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:29: cannot find symbol
symbol  : method withdraw(double)
location: class MyCustomer
                cust1.getAccount(4); withdraw(20000.0);
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:33: cannot find symbol
symbol  : method addAccount(Account)
location: class Customer
                cust3.addAccount(account);
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:34: cannot find symbol
symbol  : class Savingsaccount
location: class MyCustomer
                cust3.addAccount(new Savingsaccount(51070.0,0.04));  //saving accountNo= 3
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:35: cannot find symbol
symbol  : method addAccount(CheckingAccount)
location: class Customer
            cust3.addAccount(new CheckingAccount(755.0,210000.0));  //saving accountNo =4
                ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:36: cannot find symbol
symbol  : method deposit(double)
location: class MyCustomer
        cust3.getAccount(5); deposit(1000.0);
                            ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:37: cannot find symbol
symbol  : method withdraw(double)
location: class MyCustomer
                cust3.getAccount(5); withdraw(2450.0);
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:41: cannot find symbol
symbol  : method addAccount(Account)
location: class Customer
                cust3.addAccount(account);
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:42: cannot find symbol
symbol  : class Savingsaccount
location: class MyCustomer
                cust3.addAccount(new Savingsaccount(5070.0,0.06));  //saving accountNo= 3
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:43: cannot find symbol
symbol  : method addAccount(CheckingAccount)
location: class Customer
                cust3.addAccount(new CheckingAccount(700.0,45800.0));  //saving accountNo =4
                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:44: cannot find symbol
symbol  : method deposit(double)
location: class MyCustomer
                cust3.getAccount(5); deposit(1606.0);
                                    ^
F:\JAVA\Java Files\lab 9\MyCustomer.java:45: cannot find symbol
symbol  : method withdraw(double)
location: class MyCustomer
                cust3.getAccount(5); withdraw(1676.0);
                                    ^
18 errors

Tool completed with exit code 1

java source file

import java.text.*;

public class MyCustomer
{
        public static void main (String[] args)
        {
                Customer cust1, cust2, cust3, cust4;
                Account account;

                cust1 = new Customer("Debbie gralla");
                account = new CheckingAccount(5000.0, 200.0);  //accountNo = 1
                cust1.addAccount(account);
                cust1.addAccount(new Savingsaccount(5000.0,0.05));  //saving accountNo= 2
                cust1.addAccount(new CheckingAccount(200.0,0));  //saving accountNo =3

                acccount = cust1.getAccount(2);  //retrieve Debie savings account
                if (account != null)
                {
                        account.deposit(500.0);
                }

                cust1.getAccount(1); withdraw(200.0);

                cust2 = new Customer("Jack leu");
                account = new CheckingAccount(500.0,20000.0);  //accountno =4
                cust2.addAccount(account);
                cust1.addAccount(account);            // a joint account for jack/debie

                cust1.getAccount(4); withdraw(20000.0);

                cust3 = new Customer("Jill bye");
                account = new CheckingAccount(755.0,210000.0);  //accountno =5
                cust3.addAccount(account);
                cust3.addAccount(new Savingsaccount(51070.0,0.04));  //saving accountNo= 3
            cust3.addAccount(new CheckingAccount(755.0,210000.0));  //saving accountNo =4
        cust3.getAccount(5); deposit(1000.0);
                cust3.getAccount(5); withdraw(2450.0);

                cust4 = new Customer("jeena naik");
                account = new CheckingAccount(18755.0,23000.0);  //accountno =5
                cust4.addAccount(account);
                cust4.addAccount(new Savingsaccount(5070.0,0.06));  //saving accountNo= 3
                cust4.addAccount(new CheckingAccount(700.0,45800.0));  //saving accountNo =4
                cust4.getAccount(5); deposit(1606.0);
                cust4.getAccount(5); withdraw(1676.0);
        }

}
[c

Ezzaral Oct 31st, 2007 7:43 pm
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.

java_starter Oct 31st, 2007 10:30 pm
Re: Help Java error message: cannot find symbol
 
Quote:

Originally Posted by Ezzaral (Post 460896)
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

jwenting Nov 1st, 2007 1:07 am
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).

Phaelax Nov 1st, 2007 2:32 pm
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.


All times are GMT -4. The time now is 7:07 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC