当前位置: 首页 > news >正文

宝安营销型网站制作免费网站登陆模板

宝安营销型网站制作,免费网站登陆模板,做网站需要买网址吗,wordpress哪里编辑页脚目录 一、项目要求#xff1a; 二、项目环境 三、项目使用的知识点 四、项目代码 五、项目运行结果 六、项目难点分析 图书管理系统--versions1.0#xff1a; 图书管理系统--versions1.0-CSDN博客文章浏览阅读981次#xff0c;点赞29次#xff0c;收藏17次。本文使用…目录 一、项目要求 二、项目环境 三、项目使用的知识点 四、项目代码 五、项目运行结果 六、项目难点分析 图书管理系统--versions1.0 图书管理系统--versions1.0-CSDN博客文章浏览阅读981次点赞29次收藏17次。本文使用了变量数据类型顺序选择循环数组实现了一个简单的小项目--图书管理系统其中包括用户管理图书管理不同权限管理的内容不同。https://blog.csdn.net/qq_53483101/article/details/135583634?spm1001.2014.3001.5501 图书管理系统--versions2.0 图书管理系统--versions2.0-CSDN博客文章浏览阅读1k次点赞35次收藏19次。本文使用了变量数据类型顺序选择循环数组对象及属性的封装实现了一个简单的小项目--图书管理系统其中包括用户管理图书管理不同权限管理的内容不同。https://blog.csdn.net/qq_53483101/article/details/135728923?spm1001.2014.3001.5501 图书管理系统--versions3.0 图书管理系统(ArrayList和LinkedList)--versions3.0-CSDN博客本文使用了变量数据类型顺序选择循环对象及属性的封装使用ArrayList和LinkedList集合实现了一个简单的小项目--图书管理系统其中包括用户管理图书管理不同权限管理的内容不同。https://blog.csdn.net/qq_53483101/article/details/135939196?spm1001.2014.3001.5501 一、项目要求 1通过账号控制图书管理系统账号分为管理员账号和普通用户账号     1. 管理员账号和普通用户账号都可以使用手机号码密码、身份证号码密码的形式登录登录方式二选一      2.管理员账号和普通账号除了手机号码、身份中号码、密码三个数据之外还有姓名、性别、专业、住址信息 2启动系统后显示登录账号、注册账号、退出登录三个模块         a)登录账号                 1、显示管理员登录                 2、用户登录两个模块         b)注册账号                 1、显示注册管理员                 2、注册用户两个模块         c)退出登录         结束程序运行 3登录账号成功后根据账号的性质来显示不同的模块         登录管理员账号成功后显示如下模块                 1、查看所有图书图书显示哪些信息这里设计的信息有书名书的价格书的数量                 2、添加图书                 3、修改图书                  4、删除图书                 5、查看所有普通用户信息                 6、查看管理员账号信息                 7、修改管理员账号信息                 8、退出系统         登录普通账号成功后显示如下模块                 1、查看所有图书图书显示哪些信息你自行设计                 2、借阅图书                 3、归还图书                 4、显示用户信息只能查看自己的用户信息                 5、修改用户信息只能修改自己的用户信息                 6、退出系统 4使用对象对不同类及其各自属性进行封装与功能实现 二、项目环境 1开发工具IDEA、JDK17 2开发语言Java 三、项目使用的知识点 1理解程序基本概念——程序、变量、数据类型 2顺序、选择、循环、跳转语句 3使用对象的思想对图书管理系统--versions1.0进行改造         这里使用了对象封装的思想将其分为管理员用户类普通用户书类工具类系统主页面类将各自的类的属性功能封装在系统页面类里面调用这些属性方法实现各个功能的开发。   (4) 加入集合的操作取代数组对数据的存储。   (5) 数据的转型(多态)       四、项目代码 这里说明一下为了快速写出项目前面的用户管理的八个属性均采用String类型存储方便自己后续代码的编写及相关功能的实现有不足或者想要自己实现的功能部分读者可以自行修改代码实现。 AdminUser类 package com.threecode;public class AdminUser {private String adminUser;private String adminPhoneNumber;private String adminIdentityNumber;private String adminPassword;private String adminName;private String adminSex;private String adminCareer;private String adminAddress;public AdminUser() {}public AdminUser(String adminUser, String adminPhoneNumber, String adminIdentityNumber, String adminPassword, String adminName, String adminSex, String adminCareer, String adminAddress) {this.adminUser adminUser;this.adminPhoneNumber adminPhoneNumber;this.adminIdentityNumber adminIdentityNumber;this.adminPassword adminPassword;this.adminName adminName;this.adminSex adminSex;this.adminCareer adminCareer;this.adminAddress adminAddress;}public String getAdminUser() {return adminUser;}public void setAdminUser(String adminUser) {this.adminUser adminUser;}public String getAdminPhoneNumber() {return adminPhoneNumber;}public void setAdminPhoneNumber(String adminPhoneNumber) {this.adminPhoneNumber adminPhoneNumber;}public String getAdminIdentityNumber() {return adminIdentityNumber;}public void setAdminIdentityNumber(String adminIdentityNumber) {this.adminIdentityNumber adminIdentityNumber;}public String getAdminPassword() {return adminPassword;}public void setAdminPassword(String adminPassword) {this.adminPassword adminPassword;}public String getAdminName() {return adminName;}public void setAdminName(String adminName) {this.adminName adminName;}public String getAdminSex() {return adminSex;}public void setAdminSex(String adminSex) {this.adminSex adminSex;}public String getAdminCareer() {return adminCareer;}public void setAdminCareer(String adminCareer) {this.adminCareer adminCareer;}public String getAdminAddress() {return adminAddress;}public void setAdminAddress(String adminAddress) {this.adminAddress adminAddress;}Overridepublic String toString() {returnadminUser \t\t\t adminPhoneNumber \t\t\t adminIdentityNumber \t\t\t adminPassword \t\t\t adminName \t\t\t adminSex \t\t\t adminCareer \t\t\t adminAddress \t\t\t ;} } AdminUserList类 package com.threecode;import java.util.ArrayList;public class AdminUserList {private ArrayListAdminUser adminUsers new ArrayListAdminUser();public AdminUserList() {adminUsers.add( new AdminUser(root,1111,2222,123456,张三,男,计算机,安徽));}public ArrayListAdminUser getAdminUsers() {return adminUsers;}public void setAdminUsers(ArrayListAdminUser adminUsers) {this.adminUsers adminUsers;}}AdminUserAction类 package com.threecode;import java.util.ArrayList; import java.util.Scanner;/*** Author 南初* Create 2024/1/28 14:04* Version 1.0*/ public class AdminUserAction {Scanner scan new Scanner(System.in);//管理员用户登录验证public int loginCheck(AdminUserList adminUser){ArrayListAdminUser adminUsers adminUser.getAdminUsers();System.out.print(请输入你要登录的形式(1.手机号码密码 2.身份证号码密码));int verifyNum scan.nextInt(); //verifyNum 验证方式数字//只能选择一种登录方式while (true) {if (verifyNum 1 || verifyNum 2) {break;} else {System.out.print(\n输入错误请输入要选择要操作的序号(只能输入1,2):);verifyNum scan.nextInt();}}// 1.手机号码密码 2.身份证号码密码System.out.print(请输入你要登录的管理员序号(0,1,2));int adminId scan.nextInt(); // 登录管理员账号序号while(true){if(adminIdadminUsers.size()-1){break;}else {System.out.print(你输入的管理员账户不存在请重新输入你要登录的管理员序号(0,1,2));adminId scan.nextInt(); // 登录管理员账号序号}}if (verifyNum 1) { // 管理员用户// 管理员登录验证 手机号码密码System.out.println(\n请输入你的验证信息);while(true){if(adminUsers.get(adminId)null){System.out.print(\n你输入的管理员用户不存在请重新输入);adminId scan.nextInt();}else{break;}}System.out.print(\n请输入管理员账号(默认root));String adminUser1 scan.next();System.out.print(\n请输入手机号码);String adminPhoneNumber1 scan.next();System.out.print(\n请输入密码);String adminPassword1 scan.next();AdminUser a1 adminUsers.get(adminId);while (true) {if (adminUser1.equals(a1.getAdminUser()) adminPhoneNumber1.equals(a1.getAdminPhoneNumber()) adminPassword1.equals(a1.getAdminPassword())) {break;} else {System.out.println(输入信息错误请重新输入信息);System.out.print(请输入管理员账号序号(默认root):);adminUser1 scan.next();System.out.print(\n请输入手机号码:);adminPhoneNumber1 scan.next();System.out.print(\n请输入密码:);adminPassword1 scan.next();}}} else if (verifyNum 2) { // 管理员登录验证 身份证号码密码System.out.print(请输入账号(默认root));String adminUser2 scan.next();System.out.print(\n请输入身份证号码:);String adminIdentityNumber2 scan.next();System.out.print(\n请输入密码:);String adminPassword2 scan.next();AdminUser a1 adminUsers.get(adminId);while (true) {if (adminUser2.equals(a1.getAdminUser()) adminIdentityNumber2.equals(a1.getAdminIdentityNumber()) adminPassword2.equals(a1.getAdminPassword())) {break;} else {System.out.println(输入信息错误请重新输入信息);System.out.print(请输入账号(默认root):);adminUser2 scan.next();System.out.print(\n请输入身份证号码:);adminIdentityNumber2 scan.next();System.out.print(\n请输入密码:);adminPassword2 scan.next();}}}return adminId;}// 注册管理员用户public void addAdminUser(AdminUserList adminUser){ArrayListAdminUser adminUsers adminUser.getAdminUsers();System.out.print(\n请输入新的管理员账户名:);String user scan.next();System.out.print(\n请输入新的手机号码:);String phonenumber scan.next();System.out.print(\n请输入新的身份证号码:);String identitynumber scan.next();System.out.print(\n请输入新的密码:);String password scan.next();System.out.print(\n请输入新的姓名:);String name scan.next();System.out.print(\n请输入新的性别:);String sex scan.next();System.out.print(\n请输入新的专业:);String career scan.next();System.out.print(\n请输入新的住址信息:);String address scan.next();AdminUser au new AdminUser(user,phonenumber,identitynumber,password ,name,sex,career,address);boolean add adminUsers.add(au);if (add) {System.out.println(注册管理员用户成功);}else{System.out.println(注册失败);}}//查看管理员账号信息public void adminInfo(AdminUserList adminUser){System.out.println(序号\t\t\t账户名\t\t\t手机号\t\t\t身份证号\t\t\t密码\t\t\t姓名\t\t\t性别\t\t\t专业\t\t\t住址\t\t\t);ArrayListAdminUser adminUsers adminUser.getAdminUsers();for(int i0;iadminUsers.size();i){AdminUser a1 adminUsers.get(i);System.out.println(i\t\t\ta1.toString());}}//修改管理员账号信息// num 修改信息序号 id 登录的是第几个管理员public void adminAlter(int num,int id,AdminUserList adminUser) {ArrayListAdminUser adminUsers adminUser.getAdminUsers();AdminUser a1 adminUsers.get(id);if (num 1) { // 管理员账号名System.out.print(\n请输入新的管理员账户名:);String user scan.next();a1.setAdminUser(user);} else if (num 2) { // 手机号码System.out.print(\n请输入新的手机号码:);String phonenumber scan.next();a1.setAdminPhoneNumber(phonenumber);} else if (num 3) { // 身份证号码System.out.print(\n请输入新的身份证号码:);String identitynumber scan.next();a1.setAdminIdentityNumber(identitynumber);} else if (num 4) { // 密码System.out.print(\n请输入新的密码:);String password scan.next();a1.setAdminPassword(password);} else if (num 5) { // 姓名System.out.print(\n请输入新的姓名:);String name scan.next();a1.setAdminName(name);} else if (num 6) { // 性别System.out.print(\n请输入新的性别:);String sex scan.next();a1.setAdminSex(sex);} else if (num 7) { // 专业System.out.print(\n请输入新的专业:);String career scan.next();a1.setAdminCareer(career);} else if (num 8) { // 住址信息System.out.print(\n请输入新的住址信息:);String address scan.next();a1.setAdminAddress(address);}} }NormalUser类 package com.threecode;import java.util.Scanner;public class NormalUser {private String normalUser;private String normalPhoneNumber;private String normalIdentityNumber;private String normalPassword;private String normalName;private String normalSex;private String normalCareer;private String normalAddress;Scanner scan new Scanner(System.in);public NormalUser() {}public NormalUser(String normalUser, String normalPhoneNumber, String normalIdentityNumber, String normalPassword, String normalName, String normalSex, String normalCareer, String normalAddress) {this.normalUser normalUser;this.normalPhoneNumber normalPhoneNumber;this.normalIdentityNumber normalIdentityNumber;this.normalPassword normalPassword;this.normalName normalName;this.normalSex normalSex;this.normalCareer normalCareer;this.normalAddress normalAddress;}public String getNormalUser() {return normalUser;}public void setNormalUser(String normalUser) {this.normalUser normalUser;}public String getNormalPhoneNumber() {return normalPhoneNumber;}public void setNormalPhoneNumber(String normalPhoneNumber) {this.normalPhoneNumber normalPhoneNumber;}public String getNormalIdentityNumber() {return normalIdentityNumber;}public void setNormalIdentityNumber(String normalIdentityNumber) {this.normalIdentityNumber normalIdentityNumber;}public String getNormalPassword() {return normalPassword;}public void setNormalPassword(String normalPassword) {this.normalPassword normalPassword;}public String getNormalName() {return normalName;}public void setNormalName(String normalName) {this.normalName normalName;}public String getNormalSex() {return normalSex;}public void setNormalSex(String normalSex) {this.normalSex normalSex;}public String getNormalCareer() {return normalCareer;}public void setNormalCareer(String normalCareer) {this.normalCareer normalCareer;}public String getNormalAddress() {return normalAddress;}public void setNormalAddress(String normalAddress) {this.normalAddress normalAddress;}Overridepublic String toString() {return normalUser \t\t\t normalPhoneNumber \t\t\t normalIdentityNumber \t\t\t normalPassword \t\t\t normalName \t\t\t normalSex \t\t\t normalCareer \t\t\t normalAddress \t\t\t ;} }NormalUserList类 package com.threecode;import java.util.ArrayList;public class NormalUserList {private ArrayListNormalUser normalUsers new ArrayListNormalUser();public NormalUserList() {normalUsers.add(new NormalUser(normal, 9999, 123321, 123456, 李四, 男, 艺术, 北京));}public ArrayListNormalUser getNormalUsers() {return normalUsers;}public void setNormalUsers(ArrayListNormalUser normalUsers) {this.normalUsers normalUsers;} }NormalUserAction类 package com.threecode;import java.util.ArrayList; import java.util.Scanner;public class NormalUserAction {Scanner scan new Scanner(System.in);// 验证普通用户登录public int loginCheck(NormalUserList normalUser) {ArrayListNormalUser normalUsers normalUser.getNormalUsers();// 普通用户登录验证System.out.print(请输入你要登录的形式(1.手机号码密码 2.身份证号码密码));int verifyNum scan.nextInt(); //verifyNum 验证方式数字//只能选择一种登录方式while (true) {if (verifyNum 1 || verifyNum 2) {break;} else {System.out.print(\n输入错误请重新输入要选择要操作的序号(只能输入1,2):);verifyNum scan.nextInt();}}System.out.print(请输入你要登录的普通用户序号(0,1,2,3...));int normalID scan.nextInt(); // 登录普通用户账号序号// 1.手机号码密码 2.身份证号码密码while(true){if(normalIDnormalUsers.size()-1){break;}else {System.out.print(你输入的管理员账户不存在请重新输入你要登录的普通用户序号(0,1,2,3...));normalID scan.nextInt(); // 登录管理员账号序号}}if (verifyNum 1) { // 普通用户// 普通用户登录验证 手机号码密码System.out.print(\n请输入管理员账号(默认normal));String normalUser1 scan.next();System.out.print(\n请输入手机号码);String normalPhoneNumber1 scan.next();System.out.print(\n请输入密码);String normalPassword1 scan.next();NormalUser n1normalUsers.get(normalID);while (true) {if (normalUser1.equals(n1.getNormalUser()) normalPhoneNumber1.equals(n1.getNormalPhoneNumber()) normalPassword1.equals(n1.getNormalPassword())) {break;} else {System.out.println(输入信息错误请重新输入);System.out.print(\n请输入管理员账号序号(默认normal));normalUser1 scan.next();System.out.print(\n请输入手机号码:);normalPhoneNumber1 scan.next();System.out.print(\n请输入密码:);normalPassword1 scan.next();}}} else if (verifyNum 2) { // 普通用户登录验证 身份证号码密码System.out.print(\n请输入账号(默认normal):);String normalUser2 scan.next();System.out.print(\n请输入身份证号码:);String normalIdentityNumber2 scan.next();System.out.print(\n请输入密码:);String normalPassword2 scan.next();NormalUser n1normalUsers.get(normalID);while (true) {if (normalUser2.equals(n1.getNormalUser()) normalIdentityNumber2.equals(n1.getNormalIdentityNumber()) normalPassword2.equals(n1.getNormalPassword())) {break;} else {System.out.println(输入信息错误请重新输入);System.out.print(\n请输入账号:);normalUser2 scan.next();System.out.print(\n请输入身份证号码:);normalIdentityNumber2 scan.next();System.out.print(\n请输入密码:);normalPassword2 scan.next();}}}return normalID;}// 注册普通用户public void addNormalUser(NormalUserList normalUser){ArrayListNormalUser normalUsers normalUser.getNormalUsers();System.out.print(\n请输入新的用户账户名:);String user scan.next();System.out.print(\n请输入新的手机号码:);String phonenumber scan.next();System.out.print(\n请输入新的身份证号码:);String identitynumber scan.next();System.out.print(\n请输入新的密码:);String password scan.next();System.out.print(\n请输入新的姓名:);String name scan.next();System.out.print(\n请输入新的性别:);String sex scan.next();System.out.print(\n请输入新的专业:);String career scan.next();System.out.print(\n请输入新的住址信息:);String address scan.next();NormalUser n new NormalUser(user,phonenumber,identitynumber,password,name,sex,career,address);boolean add normalUsers.add(n);if (add) {System.out.println(注册普通用户成功);}else{System.out.println(注册失败);}}// 查看所有普通用户信息public void allNormal(NormalUserList normalUser){ArrayListNormalUser normalUsers normalUser.getNormalUsers();System.out.println(所有普通用户信息如下:);System.out.println(序号\t\t\t账户名\t\t\t手机号\t\t\t身份证号\t\t\t密码\t\t\t姓名\t\t\t性别\t\t\t专业\t\t\t住址\t\t\t);for(int i0;inormalUsers.size();i){NormalUser n1normalUsers.get(i);System.out.println(i\t\t\tn1.toString());}}// 修改用户信息// num 修改信息序号 id 登录的是第几个管理员public void normalAlter(int num,int normalid,NormalUserList normalUser){ArrayListNormalUser normalUsers normalUser.getNormalUsers();NormalUser n1normalUsers.get(normalid);if(num 1){ // 管理员账号名System.out.print(\n请输入新的管理员账户名:);String user scan.next();n1.setNormalUser(user);} else if (num 2) { // 手机号码System.out.print(\n请输入新的手机号码:);String phonenumber scan.next();n1.setNormalPhoneNumber(phonenumber);} else if (num 3) { // 身份证号码System.out.print(\n请输入新的身份证号码:);String identitynumber scan.next();n1.setNormalIdentityNumber(identitynumber);} else if (num 4) { // 密码System.out.print(\n请输入新的密码:);String password scan.next();n1.setNormalPassword(password); ;} else if (num 5) { // 姓名System.out.print(\n请输入新的姓名:);String name scan.next();n1.setNormalName(name);} else if (num 6) { // 性别System.out.print(\n请输入新的性别:);String sex scan.next();n1.setNormalSex(sex);} else if (num 7) { // 专业System.out.print(\n请输入新的专业:);String career scan.next();n1.setNormalCareer(career);} else if (num 8) { // 住址信息System.out.print(\n请输入新的住址信息:);String address scan.next();n1.setNormalAddress(address);}}// 显示用户信息只能查看自己的用户信息public void myInformation(int normalid,NormalUserList normalUser){ArrayListNormalUser normalUsers normalUser.getNormalUsers();NormalUser n1normalUsers.get(normalid);System.out.println(个人信息如下);System.out.println(账户名\t\t\t手机号\t\t\t身份证号\t\t\t密码\t\t\t姓名\t\t\t性别\t\t\t专业\t\t\t住址\t\t\t);System.out.println(n1.toString());} }Book类 package com.threecode;import java.util.Scanner;public class Book {private String bookName;private double bookPrice;private int bookNum;Scanner scan new Scanner(System.in);public Book() {}public Book(String bookName, double bookPrice, int bookNum) {this.bookName bookName;this.bookPrice bookPrice;this.bookNum bookNum;}public String getBookName() {return bookName;}public double getBookPrice() {return bookPrice;}public int getBookNum() {return bookNum;}public void setBookName(String bookName) {this.bookName bookName;}public void setBookPrice(double bookPrice) {this.bookPrice bookPrice;}public void setBookNum(int bookNum) {this.bookNum bookNum;}Overridepublic String toString() {return bookName \t\t\t bookPrice\t\t\t bookNum ;} }BookList类 package com.threecode;import java.util.LinkedList;public class BookList {private LinkedListBook books new LinkedListBook();public BookList() {books.add(new Book(C语言, 50.0, 40));books.add(new Book(Python, 40.0, 20));books.add(new Book(Java, 20.0, 35));books.add(new Book(Go, 45.0, 44));books.add(new Book(C, 38.0, 47));}public LinkedListBook getBooks() {return books;}public void setBooks(LinkedListBook books) {this.books books;} }BookAction类 package com.threecode;import java.util.LinkedList; import java.util.Scanner;public class BookAction {Scanner scan new Scanner(System.in);// 查看所有图书public void viewAllBook(BookList bookList){System.out.println(序号\t\t\t书名\t\t\t价格\t\t\t数量);LinkedListBook books bookList.getBooks();int i0;for(Book book : books){System.out.println(i\t\t\tbook);i;}}// 添加图书public void addBook(BookList bookList){System.out.print(\n请输入图书名);String name scan.next();System.out.print(\n请输入图书价格);double price scan.nextDouble();System.out.print(\n请输入图书数量);int num scan.nextInt();Book book1 new Book(name,price,num);LinkedListBook book bookList.getBooks();boolean add book.add(book1);if (add) {System.out.println(添加图书信息如下);System.out.println(序号\t\t\t书名\t\t\t价格\t\t\t数量);System.out.println(book.size()-1\t\t\tbook.getLast().toString());System.out.println(添加成功);}else{System.out.println(添加图书失败);}}// 修改图书public void alterBook(BookList bookList){LinkedListBook book bookList.getBooks();System.out.print(请输入修改图书序号:);int bookIDscan.nextInt(); //修改图书序号while(true){if(bookID0bookIDbook.size()){break;}else {System.out.println(输入错误请输入(0~(book.size()-1))内数字);bookIDscan.nextInt();}}Book b1 book.get(bookID);System.out.print(\n请输入图书名);String name scan.next();b1.setBookName(name);System.out.print(\n请输入图书价格);double price scan.nextDouble();b1.setBookPrice(price);System.out.print(\n请输入图书数量);int num scan.nextInt();b1.setBookNum(num);}// delete 删除图书public void deleteBook(BookList bookList) {LinkedListBook book bookList.getBooks();System.out.println(请输入删除图书序号);int bookIDscan.nextInt(); //修改图书序号while(true){if (bookID 0 bookID book.size()) {book.remove(bookID);System.out.println(删除成功);break;}else {System.out.println(输入错误,请重新输入删除图书序号);bookIDscan.nextInt(); //修改图书序号}}}// 借阅图书public void borrowBook(BookList bookList){LinkedListBook book bookList.getBooks();System.out.print(\n请输入你要借阅图书序号);int numbook scan.nextInt();Book b1 book.get(numbook);System.out.print(\n该图书还有b1.getBookNum()本);System.out.print(\n请输入你要借的图书数量:);int nums scan.nextInt(); // 借阅数量if((b1.getBookNum()-nums)0){b1.setBookNum(b1.getBookNum()-nums);int num b1.getBookNum();System.out.print(\n恭喜你借阅成功该图书还剩余num本\n);}else{System.out.print(\n很遗憾该图书已经全被借阅);}}// 归还图书public void giveBackBook(BookList bookList){LinkedListBook book bookList.getBooks();System.out.print(\n请输入你要归还图书序号);int bk scan.nextInt();Book b1 book.get(bk);System.out.print(\n该图书目前剩余b1.getBookNum()本);System.out.print(\n请输入归还书本数目:);int givenum scan.nextInt();b1.setBookNum(b1.getBookNum()givenum);int num b1.getBookNum();System.out.print(\n恭喜你归还成功,现剩余该图书num本);} }Tool类 package com.threecode;public class Tool {public void page1(){System.out.println(----------------请选择登录方式----------------);System.out.println( 1、登录账号);System.out.println( 2、注册账号);System.out.println( 3、退出登录);}public void page2(){System.out.println(********欢迎进入登录账号页面********);System.out.println(1.管理员登录:);System.out.println(2.普通用户登录:);}public void page3(){System.out.println(\n-----------欢迎进入管理员账号页面-----------);System.out.println(1、查看所有图书);System.out.println(2、添加图书);System.out.println(3、修改图书);System.out.println(4、删除图书);System.out.println(5、查看所有普通用户信息);System.out.println(6、查看管理员账号信息);System.out.println(7、修改管理员账号信息);System.out.println(8、退出系统);}public void page4(){System.out.println(\n-----------普通用户登录成功-----------);System.out.println(1.查看所有图书);System.out.println(2.借阅图书);System.out.println(3.归还图书);System.out.println(4.显示用户信息只能查看自己的用户信息);System.out.println(5.修改用户信息只能修改自己的用户信息);System.out.println(6.退出系统);}public void page5(){System.out.println(********欢迎进入注册账号页面********);System.out.println(1.管理员注册:);System.out.println(2.普通用户注册:);}}BooksManagementSystemThree类 package com.threecode;import java.util.Scanner;public class BooksManagementSystemThree {public static void main(String[] args) {Scanner scan new Scanner(System.in);Tool tool new Tool();AdminUserList adminUserList new AdminUserList();AdminUserAction adminUserAction new AdminUserAction();NormalUserList normalUserList new NormalUserList();NormalUserAction normalUserAction new NormalUserAction();BookList bookList new BookList();BookAction bookAction new BookAction();while(true){while(true) {tool.page1();System.out.print(请输入要选择要操作的序号(只能输入1,2,3):);int loginNum scan.nextInt();// 校验输入的序号只能是1到3while (true) {if (loginNum 1 || loginNum 2 || loginNum 3) {break;} else {System.out.print(请输入要选择要操作的序号(只能输入1,2,3):);loginNum scan.nextInt();}}switch(loginNum){case 1:tool.page2();System.out.print(请输入要选择要操作的序号(只能输入1,2):);int enterNum scan.nextInt(); //enterNum登录数字 1.管理员 2.用户while(true){if(enterNum 1||enterNum 2 ){break;}else{System.out.print(输入错误请从从新输入要选择要操作的序号(只能输入1,2):);enterNum scan.nextInt();}}if(enterNum1){int adminID adminUserAction.loginCheck(adminUserList);while(true) {tool.page3();System.out.print(请输入你选择的功能:);int adminnum scan.nextInt(); // adminnum 管理员账号页面功能查看while(true){if(adminnum1adminnum8){break;}else{System.out.print(输入错误,请重新输入你选择的功能:);adminnum scan.nextInt();}}if(adminnum 1){ //1、查看所有图书bookAction.viewAllBook(bookList);continue;} else if (adminnum2) { //2、添加图书bookAction.addBook(bookList);continue;} else if (adminnum3) { //3、修改图书 //这里设计的是符合图书序号的所有图书信息都可以修改bookAction.alterBook(bookList);continue;} else if (adminnum4) { //4、删除图书bookAction.deleteBook(bookList);continue;} else if (adminnum5) { //5、查看所有普通用户信息normalUserAction.allNormal(normalUserList);continue;} else if (adminnum6) { //6、查看管理员账号信息adminUserAction.adminInfo(adminUserList);continue;} else if (adminnum7) { //7、修改管理员账号信息System.out.println(请输入要修改管理员账号的的信息(1管理员账号名2手机号码3 身份证号码4密码5姓名6性别7专业8住址信息):);int adID scan.nextInt(); // adID 修改序号adminUserAction.adminAlter(adID, adminID,adminUserList);continue;}else if (adminnum8){ //8、退出系统System.out.println(谢谢使用欢迎下次光临);System.exit(0);;}}} else if (enterNum 2) {int normalID normalUserAction.loginCheck(normalUserList);while(true){tool.page4();System.out.print(请输入你需要操作功能的数字);int onetwo1 scan.nextInt(); // 选择功能数字if(onetwo11){ // 1.查看所有图书bookAction.viewAllBook(bookList);continue;} else if (onetwo12) { // 2.借阅图书bookAction.borrowBook(bookList);continue;} else if (onetwo13) { // 3.归还图书bookAction.giveBackBook(bookList);continue;} else if (onetwo14) { // 4.显示用户信息只能查看自己的用户信息normalUserAction.myInformation(normalID,normalUserList);continue;} else if (onetwo15) { // 5.修改用户信息只能修改自己的用户信息System.out.print(\n请输入你要修改的信息的选项(1普通用户账号名2手机号码 3身份证号码4密码5姓名6性别7专业8住址信息):);int numscan.nextInt(); // normalchange 修改序号normalUserAction.normalAlter( num, normalID,normalUserList);continue;} else if (onetwo16) { // 6.退出系统System.out.print(\n谢谢使用欢迎下次光临);System.exit(0);;}}}case 2:tool.page5();System.out.print(请输入要选择要操作的序号(只能输入1,2):);int registernum scan.nextInt(); //注册管理员或者普通用户while(true){if(registernum0||registernum3){break;}else {System.out.println(输入序号错误请重新输入要操作的序号(只能输入1,2):);registernum scan.nextInt();}}if(registernum1){adminUserAction.addAdminUser(adminUserList);continue;} else if (registernum2) {normalUserAction.addNormalUser(normalUserList);continue;}case 3:System.out.println(谢谢使用欢迎下次光临);System.exit(0);;}}}} }五、项目运行结果 说明一下这里并没有校验输入数据限制是没写太麻烦了读者想要校验输入格式可以自行实现。         这里输入的数字均是int类型输入其他类型数据可能直接报错退出程序。         说明功能没有截图完全其余功能实现读者可以自行运行实现查看。 六、项目难点分析 1、校验功能数字是自己规定的数字         使用while(true){}循环实现在循环体中设置只有输入规定数字才能跳出循环执行后面的代码。       System.out.print(请输入要选择要操作的序号(只能输入1,2):);int enterNum scan.nextInt();  //enterNum登录数字  1.管理员  2.用户while(true){if(enterNum 1||enterNum 2 ){break;}else{System.out.print(输入错误请从从新输入要选择要操作的序号(只能输入1,2):);enterNum scan.nextInt();}} 2、明确变量的定义域 要清楚自己定义的变量作用的范围         在Java中变量的作用域决定了变量在程序中可见的范围。如果一个变量被定义在一个代码块内部那么它的作用域就被限制在该代码块内部。如果一个变量被定义在方法内部那么它的作用域就被限制在该方法内部。如果一个变量被定义在类内部但方法之外那么它的作用域就是整个类。         这里要注意的是作用范围大的变量例如adminUser、bookName...等等要定义在整个循环体的外面若是定义在while(){}、for(;;){}、do{}while()三种循环和if(){}else{}、switch(){}选择语句中变量作用域只能在循环体或者选择语句中只用在循环体或者选择语句中使用此范围之外不能使用或者可能出现操作该变量失效的现象。 3、将其划分为不同的类在不同类里面进行不同类单独的属性方法的开发与封装。 4、加入集合的操作取代数组对数据的存储。          根据集合的特点使用                 a)ArrayList     底层是数组实现的方便查询操作           这里管理员用户和普通用户类基本很少涉及增删所以使用ArrayList 集合                 b)LinkedList   底层是双向链表实现的方便增加和删除         这里的Book类可能涉及多次的增删所以使用LinkedList集合 5、数据的转型(多态)         例如 这里的         ArrayListNormalUser normalUsers normalUser.getNormalUsers();         在NormalUserAction类中想要使用NormalUser类中的属性必须要从集合中取出目标操作类将其转换为NormalUser才可以使用其定义的特有方法。         NormalUser n1normalUsers.get(normalid);
http://www.dnsts.com.cn/news/161946.html

相关文章:

  • 网站外链怎么发常熟网站优化
  • 微信小程序企业网站电销客户资源怎么找
  • 广西住房与城乡建设厅网站网站改版 需求文档
  • wordpress幻灯片回收站在哪里然后建设一个论坛网站
  • 医院网站队伍建设wordpress 商品页规格
  • 重庆企业网站制作外包宁波建站
  • 连云港做电商网站的公司网站建设哪家公司
  • 中企动力做网站怎样自己建一个网站
  • 深圳网站建设网页制作手机购物网站建设
  • 做网站要考虑什么沈阳做网站开发公司
  • 为网站添加统计如何搭建微信公众号平台
  • 山西太原建站哪家弿福州公司网站建设一定要用主流程序php语言
  • 请上传网站应用水印图片手机网站建设专家
  • 装修公司 网站模板企业网站的基本内容
  • 怎么做网站内的搜索wordpress 图片水印插件
  • 网站图片上的水印怎么做单县住房和城乡建设局网站
  • 网站前台 后台洛阳住房和城乡建设厅网站
  • 网站搜索模块建自己网址的免费网页
  • 笔记本电脑可以做网站服务器河南省建设银行网站
  • 网站建设教程平台wordpress php 5.2.17
  • 手机字体下载大全免费网站黄骅市有什么好玩的地方
  • 用jsp做网站步骤深圳做网站比较好的公司有哪些
  • 江苏省建设集团有限公司网站首页广州3d网站开发
  • 桐乡住房和建设局网站爱做网站免费版
  • 婚恋网站建设的目的怎么评价一个网站设计做的好坏
  • 365网站建设电子商务公司属于什么行业类别
  • 高校后勤网站建设要求及内容网站建设对比
  • 建一个类似淘宝的网站需要多少钱免费公司网站源码
  • 新余商城网站建设广州网站制作公司电话
  • 安徽省建设厅八大员报名网站注册了域名怎样做网站