0

有人可以在这里指出我正确的方向或填写我缺少的内容。真的很感激。谢谢

我收到这些错误:

E:\Data Netw Proj\BankingApp\BankingServant.java:26: error: cannot find symbol
ArrayList <Accounts> accounts = new ArrayList<Accounts>();
           ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:26: error: cannot find symbol
ArrayList <Accounts> accounts = new ArrayList<Accounts>();
                                              ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:37: error: cannot find symbol
        Accounts lodge = new Accounts();
        ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:37: error: cannot find symbol
        Accounts lodge = new Accounts();
                             ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:47: error: cannot find symbol
        Accounts trans = new Accounts();
        ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:47: error: cannot find symbol
        Accounts trans = new Accounts();
                             ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:58: error: cannot find symbol
        Accounts with = new Accounts();
        ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:58: error: cannot find symbol
        Accounts with = new Accounts();
                            ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:67: error: cannot find symbol
        Accounts bal = new Accounts();
        ^
  symbol:   class Accounts
  location: class BankingServant
E:\Data Netw Proj\BankingApp\BankingServant.java:67: error: cannot find symbol
        Accounts bal = new Accounts();
                           ^
  symbol:   class Accounts
  location: class BankingServant
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
10 errors

Tool completed with exit code 1

这是代码:

//package BankingApp;

//import BankingApp._BankingImplBase;
import BankingApp.*;
import java.util.ArrayList;
import java.util.Iterator;

public class BankingServant extends _BankingImplBase {
     private String accName;
     private int lodgementAmount ;
     private int transAmount ;
     private int transAccName ;
     private int withAccName;
     private int withAmount;
     private int checkBal;

private class Account {

    String accName;
    int lodgementAmount;
    int transAmount;
    int withAmount;
    int checkBal;
    ArrayList <Account> accounts;
}
ArrayList <Accounts> accounts = new ArrayList<Accounts>();
{
    ArrayList<Account> accounts = new ArrayList();


    }


    public boolean makeLodgement(String accName, int lodgementAmount) {

        System.out.println("Lodgement");
        Accounts lodge = new Accounts();
        lodge.accName = accName;
        lodge.lodgementAmount = lodgementAmount;
        lodge.accounts = this.accounts;
        accounts.add(lodge);
        System.out.println("Money Lodged");

}
    public boolean makeTransfer(String transAccName, int transAmount) {
        System.out.println("transfer");
        Accounts trans = new Accounts();
        trans.transAccName = transAccName;
        trans.transAmount = transAmount;
        trans.accounts = this.accounts;
        accounts.add(trans);
        System.out.println("Money transfered");

}

    public boolean makeWithdrawl(String withAccName, int withAmount) {
        System.out.println("Withdrawl");
        Accounts with = new Accounts();
        with.withAccName = withAccName;
        with.withAmount = withAmount;
        with.accounts = this.accounts;
        accounts.add(with);
        System.out.println("Money Withdrawn");
}
    public boolean checkBalance(String balAccName, int checkBal) {
        System.out.println("Balance");
        Accounts bal = new Accounts();
        bal.transAccName = balAccName;
        bal.checkBal = checkBal;
        bal.accounts = this.accounts;
        accounts.add(bal);
        System.out.println("balance is: ");
}

}
4

1 回答 1

3

类名是Account,您将其称为Accounts. 这就是错误。

将数组列表声明为ArrayList<Account>

于 2012-12-07T16:53:29.257 回答