This site requires JavaScript, please enable it in your browser!
Greenfoot back
divinity
divinity wrote ...

2016/11/12

cannot find symbol

divinity divinity

2016/11/12

#
hi danpost can u help me figure out this error, have checked all over to see what and where is causing the compile to complain saying it cannot find symbol but for the life of me I cannot. am the following the instruction of this program,(this is really my assignment) where it says to make a private person data field name owner that stores the details of the person who owns the account. daiz the only error am experiencing at the moment here is the codes everything seem to be in place but doh know how and why this persistent error coming from any help would be appreciate
public class Account {
    
    //instantiate the variables
    private int accId =0;
    private double balance =0;
    private Person owner;
    
    public Account()
    {
        //no args const
    }
    public Account(int i, double b, Person o){
        accId = i;
        balance = b;
        Person = o; (this is where the error is.  when i initialize it in the constructor. there error is cannot find symbol
    }
    //getting the id
    public int getaccId(){
        return accId;
    }
      //get owner
    public Person getowner(){
        return owner;
    }
    //get balance
    public double getbalance(){
        return balance;
    }
    //setting accId
    public void setaccId(int i){
        this.accId = i;
    }
    public void setowner(Person owner){
        this.owner = owner;
    }
    public void setbalance(double balance){
        this.balance = balance;
    }
    public void deposit (double amt){
        balance +=amt;
    }
    public void withdraw(double amt){
        balance -=amt;
    }
    public String toString(){
        String getdata = " Account ID "+ accId+" "+
                "Person "+owner+" "+ "Balance "+balance;
        
        return getdata;
                
    }
Super_Hippo Super_Hippo

2016/11/12

#
The name of the variable is 'owner' and not 'Person', so the line should read:
owner = o;
divinity divinity

2016/11/12

#
thanks a lots super_hippo, thanz soooo very much
You need to login to post a reply.