package nameyu; import java.util.Scanner;public class Test { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); System.out.print("Enter the amount of savings :"); double dollar=input.nextDouble(); System.out.print("Enter annual rate:"); double annualrate=input.nextDouble(); System.out.print("Number of months :"); int mouth=input.nextInt(); double sum=0; double MonthlyInterestRate=annualrate/1200; for(int i=1;i<=mouth;i++){ sum=(sum+dollar)*(1+MonthlyInterestRate); } System.out.println(sum); } }
|