cannot find symbol - variable acct

Hi there,

Apologies for asking a simple question I am having a hard time trying to find out where I am missing the name varialbe.

As you will see this is quite new too me. My issue is with Accounts = accts.

Much appreciation in advance for any assistance than can be given.

Below is the code I am working on.

kj

public class Customer

{

private int CustID = '0';

private String Account;

private String firstName;

private String lastName;

private int numOfAccounts = '0';

private String DOB;

private String emailAddress;

private String streetAddress;

private String streetNumber;

private String postalCode;

public void getCustID (int CustID)

{

CustID = '0';

}

public String getAccount(String Account)

{

return Account;

}

public String getName()

{

return lastName + "," + firstName;

}

public void getEmail (String emailAddress)

{

emailAddress = emailAddress;

}

public String getAddress()

{

return streetAddress + streetNumber + postalCode;

}

public void getNumOfAccount (int numOfAccount)

{

numOfAccount = '0';

}

public void getPhone (int Phone)

{

Phone = '0';

}

public void getDOB (String DOB)

{

DOB = DOB;

}

public void setDOB (String DOB)

{

DOB = DOB;

}

public void setName (String firstName, String lastName)

{

firstName=firstName;

lastName=lastName;

}

public void setAccount (String Account)

{

Account= acct;

}

}

[1712 byte] By [k_ja] at [2007-11-27 8:45:13]
# 1

> public void setAccount (String Account)

> {

> Account= acct;

> }

> }

this is wrong. Firstly you should use lowercase for beginning of variable names. Secondly look at the code... where is acct? with this example it should be as follows:

this.Account = Account

You may find it beneficial to do some of Suns tutorials?

p.s. Use the code tags to format the code properly :-)

ita6cgra at 2007-7-12 20:46:17 > top of Java-index,Java Essentials,New To Java...
# 2

My issue is also with "Account = accts" - there's no such variable in your code called accts. I suspect the argument to the setAccount method should be called accts. By the way, the convention is that class names begin with an Uppercase letter, and variables with a lower-case one. Stick to that convention!

georgemca at 2007-7-12 20:46:17 > top of Java-index,Java Essentials,New To Java...
# 3
You really need to do some tutorials theres a lot of redundant code and errors.
ita6cgra at 2007-7-12 20:46:17 > top of Java-index,Java Essentials,New To Java...
# 4
Why are you assigning char literals to all of your ints?private int CustID = '0';
hunter9000a at 2007-7-12 20:46:17 > top of Java-index,Java Essentials,New To Java...
# 5
> You really need to do some tutorials theres a lot of> redundant code and errors.Indeed there are. For one thing, the integers 0 and '0' are not the same thing. Methods that start with "get" generally do not return anything, unless it's 'this'
georgemca at 2007-7-12 20:46:17 > top of Java-index,Java Essentials,New To Java...
# 6

public void getDOB (String DOB)

{

DOB = DOB;

}

public void setDOB (String DOB)

{

DOB = DOB;

}

Neither of these methods do anything, on top of the fact that they're identical. All they do is reassign the parameter to itself, and then throw it away when the method ends. If you want to access the class variable of the same name, use this.DOB

hunter9000a at 2007-7-12 20:46:17 > top of Java-index,Java Essentials,New To Java...