功能看似简单,但真正实现起来也不是易事
现在贴出代码,欢迎各位幕友提出建议!!
package test01;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
System.out.println("欢迎使用数字转换器(Designed by chph)!!");
String in;
boolean isRunning = true;
Scanner scanner = new Scanner(System.in);
while (isRunning) {
System.out.println("请输入一串纯整数:");
in = scanner.next();
String input = in.trim();
if (!isNum(input)) {
System.out.println("输入类型错误!!!你应该输入12位以内纯正整数!!!");
continue;
} else {
System.out.println("转换成中文数字为:" + num2Ch(input));
}
System.out.println("是否继续查询? 1.是 2.不,谢谢");
int isContinue = scanner.nextInt();
if (isContinue == 1) {
continue;
} else if (isContinue == 2) {
System.out.println("程序结束!欢迎下次使用!!!");
isRunning = !isRunning;
} else {
System.out.println("指令输入错误,直接退出!!");
System.out.println("程序结束!