有人可以查看我的代码中我试图取消和关闭帐户的部分吗?这就是我想要实现的目标:
"2.向您的Account类添加一个方法void close().此方法应通过将"CLOSED"附加到帐户名并将余额设置为0来关闭当前帐户.(帐号应保持不变.)同时减少帐户总数."
当我尝试编译它时,该程序给了我一个关于标识符的错误.我错过了什么?
//*******************************************************/
// Account.java
//
// A bank account class with methods to deposit to, withdraw from,
// change the name on, and get a String representation
// of the account.
//*******************************************************/
public class Account
{
private double balance;
private String name;
private long acctNum;
//----------------------------------------------
//Constructor -- initializes balance, owner, and account number
//----------------------------------------------
public Account(double initBal, String owner, long number)
{
balance = initBal;
name = owner;
acctNum = number;
}
//----------------------------------------------
// Checks to …Run Code Online (Sandbox Code Playgroud) java ×1