最新java 图书馆系统(附全代码)_课程设计报告.doc

上传人:1595****071 文档编号:33751111 上传时间:2022-08-12 格式:DOC 页数:83 大小:1.82MB
返回 下载 相关 举报
最新java 图书馆系统(附全代码)_课程设计报告.doc_第1页
第1页 / 共83页
最新java 图书馆系统(附全代码)_课程设计报告.doc_第2页
第2页 / 共83页
点击查看更多>>
资源描述

《最新java 图书馆系统(附全代码)_课程设计报告.doc》由会员分享,可在线阅读,更多相关《最新java 图书馆系统(附全代码)_课程设计报告.doc(83页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精品资料java 图书馆系统(附全代码)_课程设计报告.数据库系统概论课程报告课题名称: 小型图书管理系统课题负责人名(学号): best同组成员名单(角色): 指导教师: 评阅成绩: 评阅意见: 提交报告时间:2015年12月15日小型图书管理系统计算机科学与技术 专业学生 指导老师 摘要 随着计算机技术的飞速发展,利用计算机来获得和处理信息是当今信息管理的一大特点。伴随计算机硬件的快速发展,有关信息管理的软件数据库系统软件也在迅猛发展着。图书馆是高等院校的重要组成部门,是教师和学生获取知识的重要场所。由于图书馆主要从事大量的图书资料的储存和流通。所以一直以来,计算机在图书馆的图书管理中得到

2、了广泛的应用。本系统实现图书信息管理的系统化,规范化和自动化,以最大程度提高操作人员的办公效率。关键词:JAVA、JDBC、SQL Server、数据库、图书馆管理一、实验题目:小型图书管理系统二、实验的目的和要求:完成一个小型图书管理系统,功能要求如下:1) 能够通过书籍基本信息(包括:书号、书名、出版社、出版日期、作者、内容摘要)单个或以AND方式组合多个条件查询书籍信息;2) 对于每一种书籍,除可查看其基本信息之外还可查看其总数以及目前在馆数量3) 可增添新的书籍4) 可删除已有书籍(如有读者借了该书籍尚未归还,则不允许删除)5) 可修改书籍的基本信息6) 能够通过读者基本信息(包括:证

3、号、姓名、性别、系名、年级)单个或以AND方式组合多个条件查询读者信息7) 对于每位读者除可查看其基本信息之外,还可查看其已借的书籍列表、数量、借还日期8) 可增添新的读者9) 可删除已有读者(如该读者有尚未归还的借书,则不允许删除)10) 可修改读者的基本信息11) 可完成借还书籍的手续12) 还书时如超期,应该显示超期天数13) 借书时如果有超期的书没有还,则不允许借书14) 可查询有哪些读者有超期的书没有还,列出这些读者的基本信息三、实验的环境:1、硬件环境:CPU: Intel(R) Core i5-3230 2.60GHz RAM: 8GB2、软件环境:操作系统:Windows 7

4、Ultimate SP1 编译软件:Eclipse Luna Microsoft SQL Server 2014四、系统ER图五、表结构定义(使用表格说明)六、系统功能模块1) 能够通过书籍基本信息单个或组合多个条件查询书籍信息;2) 对于每一种书籍,除可查看其基本信息之外还可查看其总数以及目前在馆数量3) 可增添新的书籍4) 可删除已有书籍(如有读者借了该书籍尚未归还,则不允许删除)5) 可修改书籍的基本信息6) 能够通过读者基本信息单个或组合多个条件查询读者信息7) 对于每位读者除可查看其基本信息之外,还可查看其已借的书籍列表、数量、借还日期8) 可增添新的读者9) 可删除已有读者(如该读

5、者有尚未归还的借书,则不允许删除)10) 可修改读者的基本信息11) 可完成借还书籍的手续12) 还书时如超期,应该显示超期天数13) 借书时如果有超期的书没有还,则不允许借书14) 可查询有哪些读者有超期的书没有还,列出这些读者的基本信息七、程序框架流程图九、程序运行结果八、核心代码AddBook.javaimport java.awt.BorderLayout;import java.awt.Container;import java.awt.GridLayout;import java.awt.event.*;import java.util.ArrayList;import javax

6、.swing.*;public class AddBook extends JFrame implements ActionListener SQLOperation op = new SQLOperation();Container c = getContentPane();JPanel p1 = new JPanel();JLabel bookNumber = new JLabel(Book Number:);JLabel bookName = new JLabel(Book Name:);JLabel bookAuthor = new JLabel(Book Author:);JLabe

7、l press = new JLabel(Press:);JLabel pressTime = new JLabel(Press time:);JLabel bookAbstract = new JLabel(Abstract:);JLabel storage = new JLabel(Storage:);JLabel remain = new JLabel(Remain);JLabel remain1 = new JLabel(Update with Storage);JTextField numberField = new JTextField();JTextField nameField

8、 = new JTextField();JTextField authorField = new JTextField();JTextField pressField = new JTextField();JTextField pressTimeField = new JTextField();JTextField abstractField = new JTextField();JTextField storageField = new JTextField();JButton cancel = new JButton(Cancel);JButton confirm = new JButto

9、n(Confirm!);public AddBook() c.add(p1, BorderLayout.NORTH);p1.setLayout(new GridLayout(9, 2, 20, 10);p1.add(bookNumber);p1.add(numberField);p1.add(bookName);p1.add(nameField);p1.add(bookAuthor);p1.add(authorField);p1.add(press);p1.add(pressField);p1.add(pressTime);p1.add(pressTimeField);p1.add(bookA

10、bstract);p1.add(abstractField);p1.add(storage);p1.add(storageField);p1.add(remain);p1.add(remain1);p1.add(cancel);p1.add(confirm);cancel.addActionListener(this);confirm.addActionListener(this);public void actionPerformed(ActionEvent e) / TODO Auto-generated method stubif (e.getSource() = cancel) thi

11、s.dispose();if (e.getSource() = confirm) this.dispose();BookInfo book = new BookInfo(numberField.getText(),nameField.getText(), authorField.getText(),pressField.getText(), pressTimeField.getText(),abstractField.getText(), Integer.parseInt(storageField.getText(),Integer.parseInt(storageField.getText(

12、);ArrayList strArray = new ArrayList();strArray = op.addBookJudgement();int n = 0;int replicate = 0;while (n Integer.parseInt(strArray.get(0) n+;if (numberField.getText().equals(strArray.get(n) replicate+;if (replicate = 0) op.saveBook(book);JOptionPane.showMessageDialog(null, Add a book successfull

13、y!,Information, JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog(null,This book(number) has already existed!, Warning,JOptionPane.INFORMATION_MESSAGE);AddReader.javaimport java.awt.BorderLayout;import java.awt.Container;import java.awt.GridLayout;import java.awt.event.*;import ja

14、va.util.ArrayList;import javax.swing.*;public class AddReader extends JFrame implements ActionListener SQLOperation op = new SQLOperation();Container c = getContentPane();JPanel p1 = new JPanel();JLabel readerNumber = new JLabel(Reader Number:);JLabel readerName = new JLabel(Reader Name:);JLabel sex

15、 = new JLabel(Sex:);JLabel dpt = new JLabel(Department:);JLabel grade = new JLabel(Grade:);JTextField numberField = new JTextField();JTextField nameField = new JTextField();JTextField sexField = new JTextField();JTextField dptField = new JTextField();JTextField gradeField = new JTextField();JButton

16、cancel = new JButton(Cancel);JButton confirm = new JButton(Confirm!);public AddReader() c.add(p1, BorderLayout.NORTH);p1.setLayout(new GridLayout(6, 2, 20, 10);p1.add(readerNumber);p1.add(numberField);p1.add(readerName);p1.add(nameField);p1.add(sex);p1.add(sexField);p1.add(dpt);p1.add(dptField);p1.a

17、dd(grade);p1.add(gradeField);p1.add(cancel);p1.add(confirm);cancel.addActionListener(this);confirm.addActionListener(this);public void actionPerformed(ActionEvent e) / TODO Auto-generated method stubif (e.getSource() = cancel) this.dispose();if (e.getSource() = confirm) this.dispose();ReaderInfo rea

18、der = new ReaderInfo(numberField.getText(),nameField.getText(), sexField.getText(),dptField.getText(), Integer.parseInt(gradeField.getText();ArrayList strArray = new ArrayList();strArray = op.addReaderJudgement();int n = 0;int replicate = 0;while (n Integer.parseInt(strArray.get(0) n+;if (numberFiel

19、d.getText().equals(strArray.get(n) replicate+;if (replicate = 0) if (!sexField.getText().equals(boy)& !sexField.getText().equals(girl) JOptionPane.showMessageDialog(null,In the Sex field, you can only input boy or girl!,Warning, JOptionPane.INFORMATION_MESSAGE); else op.saveReader(reader);JOptionPan

20、e.showMessageDialog(null,Add a reader successfully!, Information,JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog(null,This reader(number) has already existed!, Warning,JOptionPane.INFORMATION_MESSAGE);BookDetails.javaimport java.awt.BorderLayout;import java.awt.Container;import

21、java.awt.Dimension;import java.awt.GridLayout;import java.awt.event.*;import java.util.ArrayList;import javax.swing.*;import javax.swing.table.DefaultTableModel;public class BookDetails extends JFrame implements ActionListener SQLOperation op = new SQLOperation();Container c = getContentPane();JPane

22、l p1 = new JPanel();JPanel p2 = new JPanel();JPanel p3 = new JPanel();JLabel bookNumber = new JLabel(Book Number:);JLabel bookName = new JLabel(Book Name:);JLabel author = new JLabel(Author:);JLabel press = new JLabel(Press:);JLabel pressTime = new JLabel(Press time:);JLabel bookAbstract = new JLabe

23、l(Abstract:);JLabel storage = new JLabel(Storage:);JLabel remain = new JLabel(Remain:);JLabel numberField = new JLabel();JLabel nameField = new JLabel();JLabel authorField = new JLabel();JLabel pressField = new JLabel();JLabel pressTimeField = new JLabel();JLabel abstractField = new JLabel();JLabel

24、storageField = new JLabel();JLabel remainField = new JLabel();JButton cancel = new JButton(Cancel);JLabel details = new JLabel(Borrow and reaturn details);Object s = Reader number, Borrow time, Deadline, Over time ;Object ob1 = new Object74;JTable table = new JTable(ob1, s);JScrollPane scrollPane =

25、new JScrollPane(table);public BookDetails(String number) BookInfo book = new BookInfo(number);ob1 = op.borrowListForBook(number);for (int i = 0; i 5; i+) DefaultTableModel books = new DefaultTableModel(ob1, s);for (int n = 0; n 7; n+) for (int m = 0; m 4; m+) ob1nm = this.ob1nm;table.setModel(books)

26、;table.invalidate();ArrayList strArray = new ArrayList();strArray = op.outputBook(book);numberField.setText(number);nameField.setText(strArray.get(1);authorField.setText(strArray.get(2);pressField.setText(strArray.get(3);pressTimeField.setText(strArray.get(4);abstractField.setText(strArray.get(5);st

27、orageField.setText(strArray.get(6);remainField.setText(strArray.get(7);c.add(p1, BorderLayout.NORTH);c.add(p2, BorderLayout.CENTER);c.add(p3, BorderLayout.SOUTH);p1.setLayout(new GridLayout(9, 2, 20, 10);p1.add(bookNumber);p1.add(numberField);p1.add(bookName);p1.add(nameField);p1.add(author);p1.add(

28、authorField);p1.add(press);p1.add(pressField);p1.add(pressTime);p1.add(pressTimeField);p1.add(bookAbstract);p1.add(abstractField);p1.add(storage);p1.add(storageField);p1.add(remain);p1.add(remainField);p1.add(details);scrollPane.setBounds(0, 0, 800, 300);p2.add(scrollPane);p3.add(cancel);table.setPr

29、eferredScrollableViewportSize(new Dimension(400, 100);cancel.addActionListener(this);public void actionPerformed(ActionEvent e) / TODO Auto-generated method stubif (e.getSource() = cancel) this.dispose();BookInfo.javapublic class BookInfo private String number, name, author, press, pressTime, bookAb

30、stract;private int total, remain;/ default constructorpublic BookInfo() public BookInfo(String number) this.number = number;public BookInfo(String number, String name) this.number = number;this.name = name;public BookInfo(String number, String name, String author, String press,String pressTime, Stri

31、ng bookAbstract, int total, int remain) this.number = number;this.name = name;this.author = author;this.press = press;this.pressTime = pressTime;this.bookAbstract = bookAbstract;this.total = total;this.remain = remain;public void setRemain(int i) this.remain=i;public String getNumber() return number

32、;public String getName() return name;public String getAuthor() return author;public String getPress() return press;public String getPressTime() return pressTime;public String getBookAbstract() return bookAbstract;public int getTotal() return total;public int getRemain() return remain;BookRetrieval.j

33、avaimport java.awt.BorderLayout;import java.awt.Container;import java.awt.Dimension;import java.awt.Font;import java.awt.GridLayout;import java.awt.event.*;import java.util.ArrayList;import javax.swing.*;import javax.swing.table.DefaultTableModel;class BookRetrieval extends JFrame implements ActionL

34、istener SQLOperation op = new SQLOperation();Container c = getContentPane();JPanel p1 = new JPanel();JPanel p4 = new JPanel();JPanel p5 = new JPanel();JLabel bookNumber = new JLabel(Book Number:);JLabel bookName = new JLabel(Book Name:);JTextField number = new JTextField();JTextField name = new JTex

35、tField();JButton back = new JButton(Back (Fresh);JButton addBook = new JButton(Add a book);JButton deleteBook = new JButton(Delete a book);JButton editBook = new JButton(Edit a book);JButton search = new JButton(Search for details!);JButton borrowBook = new JButton(Borrow a book);JButton returnBook

36、= new JButton(Return a book);Font font1 = new Font(00, Font.BOLD, 20);Object s = Number, Name, Author, Press, Press Time,Abstract, Storage, Remain ;Object ob = new Object408;JTable table = new JTable(ob, s);JScrollPane scrollPane = new JScrollPane(table);public BookRetrieval() BookInfo book = new Bo

37、okInfo();ob = op.allBook(book);for (int i = 0; i 5; i+) DefaultTableModel books = new DefaultTableModel(ob, s);for (int n = 0; n 20; n+) for (int m = 0; m 8; m+) obnm = this.obnm;table.setModel(books);table.invalidate();c.add(p4, BorderLayout.NORTH);c.add(p1, BorderLayout.CENTER);c.add(p5, BorderLay

38、out.SOUTH);search.setFont(font1);p4.setLayout(new GridLayout(2, 4, 20, 10);p4.add(back);p4.add(addBook);p4.add(editBook);p4.add(deleteBook);p4.add(borrowBook);p4.add(returnBook);p1.setLayout(null);scrollPane.setBounds(0, 0, 800, 300);p1.add(scrollPane);p5.setLayout(new GridLayout(5, 1, 0, 0);p5.add(

39、bookNumber);p5.add(number);p5.add(bookName);p5.add(name);p5.add(search);table.setPreferredScrollableViewportSize(new Dimension(400, 300);addBook.addActionListener(this);search.addActionListener(this);back.addActionListener(this);deleteBook.addActionListener(this);editBook.addActionListener(this);bor

40、rowBook.addActionListener(this);returnBook.addActionListener(this);public void actionPerformed(ActionEvent e) if (e.getSource() = search) ArrayList strArray = new ArrayList();strArray = op.addBookJudgement();String s1 = number.getText();String s2 = name.getText();int n = 0;int replicate = 0;while (n

41、 Integer.parseInt(strArray.get(0) n+;if (s1.equals(strArray.get(n) replicate+;ArrayList strArray1 = new ArrayList();strArray1 = op.addBookJudgement1();int n1 = 0;int replicate1 = 0;while (n1 Integer.parseInt(strArray1.get(0) n1+;if (s2.equals(strArray1.get(n1) replicate1+;if (replicate = 0 & replicate1 = 0) JOptionPane.showMessageDialog(null,Please input a correct book number or name!,Warning, JOpt

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 小学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁