Question: I am getting this error for some reason: BankAccount.java:54: error: illegal start of expression public void transferToSavings(double amt) ^ 1 error here is this code:
I am getting this error for some reason:
BankAccount.java:54: error: illegal start of expression public void transferToSavings(double amt) ^ 1 error
here is this code:
class BankAccount { private String customerName; private double savingBalance; private double checkingBalance; public BankAccount(String newName, double amt1, double amt2) { this.customerName = newName; this.checkingBalance = amt1; this.savingBalance = amt2; } public void setName(String newName) { this.customerName = newName; } public String getName() { return this.customerName; } public void setChecking(double amt) { this.checkingBalance = amt; } public double getChecking() { return this.checkingBalance; } public void setSavings(double amt) { this.savingBalance = amt; } public double getSavings() { return this.savingBalance; } public void depositChecking(double amt) { if(amt > 0) this.checkingBalance += amt; } public void depositSavings(double amt) { if(amt > 0) this.savingBalance += amt; } public void withdrawChecking(double amt) { if(amt > 0 && this.checkingBalance >= amt) this.checkingBalance -= amt; } public void withdrawSavings(double amt) { if(amt > 0 && this.savingBalance >= amt) this.savingBalance -= amt; public void transferToSavings(double amt) { if(amt > 0 && this.checkingBalance >= amt) { this.checkingBalance -= amt;
this.savingBalance += amt; } }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
