I was doing compound interest program with switch case
where one case was display term deposit while the other one was recurring deposit.
I almost finished the program and I had no errors, but when I executed my own program, after i pressed an option, my source code box opened up and said "empty string at sun.misc.floatingdecimal".
I don't know what that means, and I need help!
This was my code:
import java.io.*;
class Bank {
public static void main (String args[]) throws IOException {
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
System.out.println("For Term Deposit press T. for Recurring Deposit, press R.");
char a;
a = (char) in.read();
double output;
switch (a) {
case 'T':
System.out.println("Enter the pricipal, Rate,and time period in years.");
double P, r, A;
int n;
P = Double.parseDouble(in.readLine());
r = Double.parseDouble(in.readLine());
n = Integer.parseInt(in.readLine());
A = P * Math.pow(1+r / 100, n);
System.out.println("The Maturity amount is + " + A);
break;
case 'R':
System.out.println("Enter your monthly deposit, rate of interest and time period in months.");
double deposit, rate, MV;
int months;
deposit = Double.parseDouble(in.readLine());
rate = Double.parseDouble(in.readLine());
months = Integer.parseInt(in.readLine());
MV = deposit*months+deposit*months*(months+1)/2*rate/100*1/12;
System.out.println("Maturity Value = " + MV);
break;
default:
System.out.println("Wrong choice!");
}
}
}