0

Cant figure out where im going wrong with this one, All of this code works individually when i comma some out but when i put it together it doesnt work. Can you explain whats going wrong here?

    public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("Enter the total sum");
        int sum = scanner.nextInt();

        System.out.println("Enter the annual interest rate");
        double rate = scanner.nextDouble() / 100;

        System.out.println("Enter the period");
        String periodInput = scanner.nextLine();
        int period = Integer.parseInt(periodInput) * 12;
        double exp = Math.pow((1 + rate),period);
        System.out.println(exp);
    }
}

0 Answers0