Static Method Qs
Static Method Qs
private static double annualInterestRate; // Static data member to store annual interest rate
private double savingsBalance; // Private data member indicating the balance of account
// Constructor
this.savingsBalance = savingsBalance;
annualInterestRate = newRate;
savingsBalance += monthlyInterest;
return savingsBalance;
}
}
SavingsAccount.modifyInterestRate(0.03);
// Calculate and print the new balances for each saver after one month
saver1.calculateMonthlyInterest();
saver2.calculateMonthlyInterest();
SavingsAccount.modifyInterestRate(0.04);
// Calculate and print the new balances for each saver after one more month
saver1.calculateMonthlyInterest();
System.out.println("Updated balance: $" + saver1.getSavingsBalance());
saver2.calculateMonthlyInterest();
}}