这是我的代码:
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
缓冲读取器 = new BufferedReader(new InputStreamReader(System.in((;
tempString = reader.readLine((;