import java.util.Scanner; /** * This class should be called Interest. Calculates amount in * account including interest earned after a certain number of years. */ public class SampleExam1Question1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final double rate = .0231; double principal; int years; principal = sc.nextDouble(); years = sc.nextInt(); double amount = principal * Math.pow(1+rate, years); System.out.printf("The amount is %.2f.\n", amount); } }