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 に答える