标签:
1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 9 System.out.print("Enter the balance amount: "); 10 double balance = input.nextDouble(); 11 System.out.print("Enter the annual interest rate: "); 12 double annualInterestRate = input.nextDouble(); 13 System.out.print("Enter the number of month: "); 14 int numberOfMonths = input.nextInt(); 15 16 input.close(); 17 18 double interest = 0; 19 20 for(int i = 0; i < numberOfMonths; i++) 21 { 22 interest = balance * (1 + annualInterestRate / 12); 23 balance += interest; 24 } 25 26 System.out.println("After that, the account‘s balance is " + balance); 27 } 28 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5785611.html