/** 10/23/2019 */

import java.util.Scanner;

public class Interest
  /** This is Question 4 on the first sample exam    */
{ 
 public static void main(String[]  args)
 {
  Scanner sc = new Scanner(System.in);
  final double INTEREST = .0231;
  System.out.println("Enter original principal that was invested: ");
  double principal = sc.nextDouble();
  System.out.println("Enter number of years: ");
  int years = sc.nextInt();
  
  // double amount = principal * Math.pow(1+INTEREST,years);
  // Suppose you are not allowed to use Math.pow, you can use a loop to calculate a
  // running product
  double base = 1+INTEREST;
  double amount = 1;
  for (int i=0; i<years; i++)
      amount*= base;
  amount*=principal;
  System.out.printf("Amount is: %.2f \n", amount);
 }
}
