Calculate total weekly interest given every day balance - Java Quiz Question


Write a program to calculate the total weekly interest, given every day balance. The daily balances of all the days in the week are given. Assume that the interest rate is 4.5% per annum and number of days in year as 365.

Input (List) Output (double)
{500.0, 1000.0, 6500.0, 500.0, 2000.0, 2500.0, 120.0} 0.8963
{20000.0, 8000.0, 14000.0, 15000.0, 25000.0, 100.0, 2500.0} 10.43014
{100.0, 200.0, 600.0, 200.0, 50.0, 300.0, 250.0} 0.20959
{4000.0, 5000.0, 20000.0, 6000.0, 200.0, 100.0, 2500.0} 4.66027


import java.util.*;
class CalculateWeeklyInterest
{
    public static void main(String s[])
    {
        ArrayList<Double> input = new ArrayList<Double>();
        input.add(4000.0);
        input.add(5000.0);
        input.add(20000.0);
        input.add(6000.0);
        input.add(200.0);
        input.add(100.0);
        input.add(2500.0);
        System.out.println("The weekly interest is : " + calculateWeeklyInterest(input));

    }


    public static double calculateWeeklyInterest(List<Double> dailyBalances) {
    }

}