Вот мой код:
import java.io.*; class InterestCalcs { public static void main(String arg[]) { Float prinAmount = new Float(0); Float ROI = new Float(0); DataInputStream in = new DataInputStream(System.in); String tempString; int noOfYears; System.out.println("Enter Amount :"); System.out.flush(); tempString = in .readLine(); prinAmount = Float.valueOf(tempString); System.out.println("Enter ROI:"); System.out.flush(); tempString = in .readLine(); ROI = Float.valueOf(tempString); System.out.flush(); tempString = in .readLine(); noOfYears = Integer.parseInt(tempString); float interestTotal = ROIprinAmountnoOfYears; System.out.println("The total interest is " + interestTotal); } }
попробуйте использовать BufferedReader
Читатель BufferedReader = новый BufferedReader (новый InputStreamReader (System.in));
tempString = reader.readLine ();