Use an array list This array list stores the values for each
Use an array list
This array list stores the values for each calculation that the user makes. When the application ends, it prints a summary of those calculations to the console. This summary should that looks something like this:
Future Value Calculations Inv
/Mo Rate Years Future value
$100.00 8.0% 10 $18,416.57
$125.00 8.0% 10 $23,020.71
$150.00 8.0% 10 $27, 624.85
1. Import the project named Future Value in the ex starts folder. Then, review the code for this application and run it to make sure it works correctly.
these are the code for the main file
 package murach.ui;
 
 import java.text.NumberFormat;
 import murach.calculators.Financial;
 
 public class Main {
 
     public static void main(String[] args) {
         // displayLine a welcome message
         Console.displayLine(\"Welcome to the Future Value Calculator\");
         Console.displayLine();
 
         String choice = \"y\";
         while (choice.equalsIgnoreCase(\"y\")) {
 
             // get input from user
             double monthlyInvestment =
                     Console.getDouble(\"Enter monthly investment:   \");
             double yearlyInterestRate =
                     Console.getDouble(\"Enter yearly interest rate: \");           
              int years =
                     Console.getInt(\"Enter number of years:      \");
            
              // call the future value method
             double futureValue = Financial.calculateFutureValue(
                     monthlyInvestment, yearlyInterestRate, years);
 
             // format and displayLine the result
             Console.displayLine(\"Future value:               \" +
                     NumberFormat.getCurrencyInstance().format(futureValue));
             Console.displayLine();
 
             // see if the user wants to continue
             choice = Console.getString(\"Continue? (y/n): \");
             Console.displayLine();
         }
         Console.displayLine(\"Bye!\");
     }
 }
2. Declare a variable at the beginning of the main method for an array list that Stores strings.
3. After the code that calculates, formats, and displays the results for each calculation, add code that formats a string with the results of the calculation and then stores the string in the array list.
4. Add code to print the elements in the array list to the console when the user exits the application. Then, test the application by making at least 3 future value calculations.
Solution
Program works correctly and make sure you import the proper package when you run this application in the IDE
package murach.ui;
import java.text.NumberFormat;
 import murach.calculators.Financial;
public class Main {
List < String > arrayList;
public static void main(String[] args) {
arrayList = new ArrayList < String > ();
System.out.println(\"Welcome to the future value calculator\");
Scanner scanner = new Scanner(System.in);
 System.out.println(\"Continue?[Y/N]\");
 String choice = \"y\";
 while (scanner.hasNext() && (scanner.nextLine().equalsIgnoreCase(\"y\"))) { //change here
 System.out.println(\"Enter monthly investment: );
 double monthlyInvestment = scanner.nextDouble(); System.out.println(\"Enter yearly interest rate: );
 double yearlyInterestRate = scanner.nextDouble(); System.out.println(\"Enter number\"); System.out.println(\"Enter the number of years\"); int years = 0;
 try {
 years = Integer.parseInt(scanner.nextLine());
 } catch (Exception e) {
}
//call the future value method
 double futureValue = Financial.calculateFutureValue(
 monthlyInvestment, yearlyInterestRate, years);
 //String.valueOf(total);
arrayList.add(String.valueOf(futureValue)); System.out.println(\"Future Value:\" +
 NumberFormat.getCurrencyInstance().format(futureValue));
if (arrayList! = null) {
 for (Object o: arrayList) {
 System.out.println(o); //print the elments
 }
 } else {
 void out();
}
 public void out() {
 System.out.println(\"Continue?[Y/N]\");
 }
 }
 System.out.println(\"Bye!\");
 }
 }



