복리이자를 계산하는이 코드가 있지만 1, 3, 5 년 후에는이 코드가 필요합니다. ive 시도하고 그것을 작동시키지 못할 것. 누구든지 나를 도울 수 있습니까?1, 3 및 5 년 후 복리이자
import java.util.Scanner;
public class CompoundInterest {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double principal = 0;
double rate = 0;
double time = 0;
double x = 0;
System.out.print("Enter the amount invested : ");
principal = input.nextDouble();
System.out.print("Enter the Rate of interest : ");
rate = input.nextDouble();
System.out.print("Enter the Time of loan : ");
time = input.nextDouble();
x = principal * Math.pow((1 + rate/12),time);
x = Math.pow(5,3);
System.out.println("");
System.out.println("The Compound Interest after 1 year is : "
+ x);
}
}
http://qrc.depaul.edu/studyguide2009/notes/savings%20accounts/compound%20interest.htm – OldProgrammer