package jieshuxitong;
import java.util.Scanner;
public class jiashu {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("**********欢迎使用借书系统*************");
Scanner input = new Scanner(System.in);
while (true) {
System.out.println("输入命令:1-按照名称查找图书;2-按照序号查找图书");
try {
switch (input.next()) {
case "1":
System.out.println("请输入图书名称:");
try {
String c = input.next();
switch (c) {
case "chinese":
System.out.println("book:chinese");
break ;
case "mathematical":
System.out.println("book:mathematical");
break;
case "english":
System.out.println("book:english");
break;
default:
System.out.println("没有" + c + "图书");
continue;
}
} catch (Exception e) {
// TODO: handle exception
Exception as = new Exception("请输入字符串!");
as.initCause(e);
throw as;
}
break;
case "2":
System.out.println("请输入图书序号:");
try {
String g = input.next();
switch (g) {
case "1":
System.out.println("book:chinese");
break;
case "2":
System.out.println("book:mathematical");
break;
case "3":
System.out.println("book:english");
break;
default:
System.out.println("没有" + g + "图书");
continue;
}
} catch (Exception e) {
// TODO: handle exception
Exception as = new Exception("请输入整数!");
as.initCause(e);
throw as;
}
break;
default :
System.out.println("输入不正确!");
break;
}
} catch (Exception e) {
// TODO: handle exception
System.out.println("输错了哈哈哈");
}
}
}
}
点击查看更多内容
2人点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦