Calculate the profit share of a given investor - Java Quiz Question



Write a program to calculate the profit share of a given investor. The list of various investors, their amounts and the number of months invested is given. The total profit is also given.

Input (List, double, String) Output (double)
{["A", 500, 12], ["B", 800, 8], ["C", 600, 6]}, 260.0, A 97.5
{["A", 10000, 12], ["B", 8000, 8], ["C", 4000, 10]}, 2800.0, B 800.0
{["A", 50, 2], ["B", 90, 5], ["C", 10, 5], ["D", 20, 10]}, 30.0, D 7.5
{ ["A", 5000, 20], ["C", 8000, 15]}, 3300.0, C 1800.0
n

class CalculateInvestorProfit

{    public static void main(String s[])
    {
        ArrayList input = new ArrayList();
        input.add(new Investment("A", 20000, 24));
        input.add(new Investment("B", 15000, 24));
        input.add(new Investment("C", 20000, 18));
        System.out.println("The profit share of B is : " + getProfit(input, 25000.0, "B"));

    }


public static double getProfit(List<Investment> investments, double profit, String investorName) {
//Write code here to find profit share of a given investor.
}
}
class Investment {

String name;
int amount;
int time;

public Investment(String name, int amount, int time) {
this.name = name;
this.amount = amount;
this.time = time;
}
}