Hi,
I created a contructor called Account but is showing some error messages:
CODE
public class Account {
private String accID;
private String accountholders[] = new String[3];
private String address;
private Double balance;
//Account Constructor holds accounts information
public Account(String newAccount, String[] newAccountHolders, String address, Double newBalance)
{
accID = newAccount;
accountHolders = newAccountHolders;
address = newAddress;
balance = newBalance;
}
public boolean printDetails(Account[] current)
{
Account arrayAccount = new Account[4];//Mismatch cannot convet from Account[] to Account
arrayAccount[0] = getAccID();
arrayAccount[1] = getAccountHolder();
arrayAccount[2] = getAddress();
arrayAccount[3] = getBalance();
}
}
//i created all the setters and getters (i didnt include those so it does make long)
--------------------------------------------------------------------------
and there is another class called Holders where
i need to print the summurize details in Account from this class
private ArrayList<Account> accounts;
public accountHolders()
{
accounts = new ArrayList<Account>();
}
public void printAccountDetails()
{
for (int i = 0; i < accounts.size(); i++)
{
Account myAccount = accounts.get(i);
System.out.println(myAccount.printAccountDetails());//The method printDetails()) is undefined fot the type Account
}
}
Edited by pbl to add the code tag please
This post has been edited by pbl: 2 Aug, 2008 - 07:25 PM