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 initial deposit amount :"); double dollar=input.nextDouble(); System.out.print("Enter annual percentage yield :"); double annualrate=input.nextDouble(); System.out.print("Enter maturity period (number of mounths) :"); int mouth=input.nextInt(); double sum=0; double MonthlyInterestRate=annualrate/1200; System.out.println("Month"+"\t"+"CD Value"); for(int i=1;i<=mouth;i++){ sum=dollar*(1+MonthlyInterestRate); dollar=sum; System.out.println(i+"\t"+sum); } } }
|