From a4a7d130abf288d2383027f56743f6babd742648 Mon Sep 17 00:00:00 2001 From: zh363y468b3 <2463925854@qq.com> Date: Wed, 28 Apr 2021 09:27:14 +0800 Subject: [PATCH] first commit --- .../\345\274\240\345\256\217/Demo2.bat" | 1 + .../\345\274\240\345\256\217/Demo2.java" | 123 ++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 "Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.bat" create mode 100644 "Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.java" diff --git "a/Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.bat" "b/Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.bat" new file mode 100644 index 0000000..4692429 --- /dev/null +++ "b/Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.bat" @@ -0,0 +1 @@ +java Demo1 diff --git "a/Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.java" "b/Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.java" new file mode 100644 index 0000000..278362e --- /dev/null +++ "b/Java\351\241\271\347\233\256_\347\274\226\350\257\221\347\211\210/\347\254\2544\345\260\217\347\273\204/\345\274\240\345\256\217/Demo2.java" @@ -0,0 +1,123 @@ +package md.lesson1.com; + +import java.util.Scanner; + +import org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID; + +public class Demo2 { + + public static void main(String[] args) { + // 1. 采用二维数组存放用户信息(部门、用户名、密码、用户角色)、 +// 书籍信息(编码(ISBN)、书籍名称、价格、出版社、作者)、 +// 出版社信息(出版社名称、地址、联系人) + + Scanner scanner = new Scanner (System.in); + + String [][] uses =new String [100][4] ; + String [][] books = new String [100][5]; + String [][] presses =new String [100][3]; + + // 2. 初始化用户信息、出版社信息、书籍信息;(设置基础信息,赋值;) + +// 3. 用户登录功能:请用户输入账号密码,对比用户信息是否正确: +// 1) 不正确提示“该用户不存在或者密码错误!请重新登录!” +// 2) 正确,进入系统菜单,“1 图书管理 2 出版社管理 3 退出系统” + + } + public static void start(String[][] uses,String[][] books) { + Scanner scanner = new Scanner (System.in); + System.out.println("欢迎来到闽大图书馆系统 !!!"); + + while(true) { + System.out.println("1.登录 /t/t2.注册"); + int key = scanner.nextInt(); + if (key==1) { + + }else if(key==2){ + + }else { + System.out.println("输入错误!请重新输入!"); + } + } + } + public static void begin (String [][] uses,String[][] books,String[][] presses) { + uses [0][0] = "管理部"; + uses [0][1] = "马冬梅"; + uses [0][2] = "12345"; + uses [0][3] = "董事长小三"; + + uses [1][0] = "厕所部"; + uses [1][1] = "玛卡巴卡"; + uses [1][2] = "1234"; + uses [1][3] = "董事长老婆"; + + uses [2][0] = "快乐星球部"; + uses [2][1] = "王多鱼"; + uses [2][2] = "123"; + uses [2][3] = "董事长"; + + books [0][0] = "10086"; + books [0][1] = "双城记"; + books [0][2] = "100"; + books [0][3] = "英国出版社"; + books [0][4] = "狄更斯"; + + presses [0][0] = "英国出版社"; + presses [0][1] = "英国"; + presses [0][2] = "狄更斯"; + + } + public static void loign (String [][] uses,String [][] books) { + Scanner scanner = new Scanner (System.in); + + while(true){ + System.out.println("请输入您的用户名:"); + String usename = scanner.next(); + + System.out.println("请输入您的密码:"); + String password = scanner.next(); + + boolean flag = false; + + for (int i = 0; i < uses.length; i++) { + if (usename.equals(uses[i][1]) && password.equals(uses[i][2])) { + flag = true; + break; + } + } + if (flag=true) { + System.out.println("登录成功!"); + + }else { + System.out.println("该用户不存在或者该用户密码错误!"); + } + } + } + public static void register(String [][] uses) { + Scanner scanner = new Scanner (System.in); + int index = -1; + + for (int i = 0; i < uses.length; i++) { + if (uses[i][0]==null) { + index=i; + break; + } + } + System.out.println("请输入所属的部门:"); + uses[index][0] =scanner.next(); + + System.out.println("请输入用户名:"); + uses[index][1] =scanner.next(); + + System.out.println("请输入密码:"); + uses[index][2] =scanner.next(); + + + uses[index][3] ="普通用户"; + System.out.println("该账号为普通用户。"); + + System.out.println("注册成功!!!"); + + + } +} -- Gitee