itialBalance; } public Account () { balance = 0; } public void deposit (double amount){ balance += amount; // Bala
public Account (double initialBalance){
balance = initialBalance;
}
public Account () {
balance = 0;
}
public void deposit (double amount){
balance += amount; // Balance = balance + amount
}
public void withdraw (double amount){
balance -= amount; // balance = balance - amount
}
public void close (){
balance = 0;
}
public String toString(){
return "balance: " + balance;
}
}
Modify the Account class by adding two instance variables containing the customer's name and the account number. Both will be String objects. Modify the primary constructor for the Account class so that it takes three parameters: the balance, the customer's name, and the account number. Add instance methods named getCustomerName and getAccountNumber that return the customer name and account number.
Step by step
Solved in 3 steps with 1 images