import java.io.IOException;import java.io.InputStreamReader;import java.io.LineNumberReader;import java.math.BigDecimal;import java.util.regex.Matcher;import java.util.regex.Pattern;public class MoneyTest { /** * @param args */ public static void main(String[] args) { while (true) { LineNumberReader in = new LineNumberReader(new InputStreamReader( System.in)); String a; try { a = in.readLine(); Matcher m = Pattern.compile("[^\\d\\.]+").matcher(a); if (a == null || a.trim().equals("") || m.find()) { System.out.println("输入的内容不合法,请重新输入:"); continue; } Integer money = Integer.valueOf(a); BigDecimal c ; if (1 评论0 0 0