Answer:
import java.util.*;
public class Main{
public static double calculateMonthlyInterest(double annualInterestRate, double savingsBalance){
double monthlyInterest = annualInterestRate * savingsBalance / 12;
return monthlyInterest; }
public static double setInterestRate (){
Scanner input = new Scanner(System.in);
System.out.print("Interest Rate: ");
double rate = input.nextDouble();
return rate; }
public static double setSavingsBalance(double monthlyInterest, double savingsBalance){
return (monthlyInterest+savingsBalance); }
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Savings Balance: ");
double savingsBalance = input.nextDouble();
double annualInterestRate = setInterestRate();
for(int i = 1;i<=12;i++){
double monthlyInterest = calculateMonthlyInterest(annualInterestRate,savingsBalance);
savingsBalance = setSavingsBalance(monthlyInterest,savingsBalance);
System.out.printf("Month "+i+" %.2f %n",savingsBalance);
}
}
}
Explanation:
The java file stated in the question is not attached to the question; So, I answered the question from the scratch.
See attachment for program file where I used comments to explain some lines