diff --git "a/18 \345\276\220\346\260\270\346\267\263/20221225 java\347\263\273\347\273\237.md" "b/18 \345\276\220\346\260\270\346\267\263/20221225 java\347\263\273\347\273\237.md" new file mode 100644 index 0000000000000000000000000000000000000000..a337b2b11879b5f1a5cd2212e3db2a23d9abca73 --- /dev/null +++ "b/18 \345\276\220\346\260\270\346\267\263/20221225 java\347\263\273\347\273\237.md" @@ -0,0 +1,154 @@ +```java +写一个书籍管理系统 +import java.util.Scanner; + +public class iuoo { + public class we { + public static void main(String[] args) { + String[] n=new String[10]; + while (true){ + zxc(); + int num=js(); + df(num,n); + if (num==6){ + break; + } + } + } + private static void zxc() { + System.out.println("" + + "\n==============================\n" + + "- 使用图书管理系统 -\n" + + "- \t\t1.浏览所有书本信息\t\t-\n" + + "- \t\t2.添加书本信息\t\t-\n" + + "- \t\t3.修改书本信息\t\t-\n" + + "- \t\t4.删除书本信息\t\t-\n" + + "- \t\t5.查询书本信息\t\t-\n" + + "- \t\t6.退出管理系统\t\t-\n" + + "=============================="); + } + + private static void df(int num,String[] n) { + switch (num){ + case 1: + xs(n); + break; + case 2: + tj(n); + break; + case 3: + xg(n); + break; + case 4: + int a=ty(n); + if (a!=-1){ + sc(a,n); + } + break; + case 5: + int b=ty(n); + if (b!=-1){ + cx(b,n); + } + break; + case 6: + break; + } + } + + private static void cx(int b, String[] n) { + System.out.println("书籍在第"+(b+1)+"个地方"); + } + + private static void sc(int a, String[] n) { + n[a]=null; + System.out.println("删除成功"); + } + + private static int ty(String[] n) { + System.out.println("输入书本名称"); + Scanner n1=new Scanner(System.in); + String mc= n1.next(); + int cf=-1; + int aa=0; + for (int i=0;i