Java 圖書館管理系統(tǒng)附全代碼課程設計報告_第1頁
Java 圖書館管理系統(tǒng)附全代碼課程設計報告_第2頁
Java 圖書館管理系統(tǒng)附全代碼課程設計報告_第3頁
Java 圖書館管理系統(tǒng)附全代碼課程設計報告_第4頁
Java 圖書館管理系統(tǒng)附全代碼課程設計報告_第5頁
已閱讀5頁,還剩56頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、數(shù)據(jù)庫系統(tǒng)概論課程報告課題名稱: 小型圖書管理系統(tǒng)課題負責人名(學號): best同組成員名單(角色): 指導教師: 評閱成績: 評閱意見: 提交報告時間:2015年12月15日小型圖書管理系統(tǒng)計算機科學與技術 專業(yè)學生 指導老師 摘要 隨著計算機技術的飛速發(fā)展,利用計算機來獲得和處理信息是當今信息管理的一大特點。伴隨計算機硬件的快速發(fā)展,有關信息管理的軟件數(shù)據(jù)庫系統(tǒng)軟件也在迅猛發(fā)展著。圖書館是高等院校的重要組成部門,是教師和學生獲取知識的重要場所。由于圖書館主要從事大量的圖書資料的儲存和流通。所以一直以來,計算機在圖書館的圖書管理中得到了廣泛的應用。本系統(tǒng)實現(xiàn)圖書信息管理的系統(tǒng)化,規(guī)范化和自

2、動化,以最大程度提高操作人員的辦公效率。關鍵詞:JAVA、JDBC、SQL Server、數(shù)據(jù)庫、圖書館管理一、實驗題目:小型圖書管理系統(tǒng)二、實驗的目的和要求:完成一個小型圖書管理系統(tǒng),功能要求如下:1) 能夠通過書籍基本信息(包括:書號、書名、出版社、出版日期、作者、內(nèi)容摘要)單個或以AND方式組合多個條件查詢書籍信息;2) 對于每一種書籍,除可查看其基本信息之外還可查看其總數(shù)以及目前在館數(shù)量3) 可增添新的書籍4) 可刪除已有書籍(如有讀者借了該書籍尚未歸還,則不允許刪除)5) 可修改書籍的基本信息6) 能夠通過讀者基本信息(包括:證號、姓名、性別、系名、年級)單個或以AND方式組合多個條

3、件查詢讀者信息7) 對于每位讀者除可查看其基本信息之外,還可查看其已借的書籍列表、數(shù)量、借還日期8) 可增添新的讀者9) 可刪除已有讀者(如該讀者有尚未歸還的借書,則不允許刪除)10) 可修改讀者的基本信息11) 可完成借還書籍的手續(xù)12) 還書時如超期,應該顯示超期天數(shù)13) 借書時如果有超期的書沒有還,則不允許借書14) 可查詢有哪些讀者有超期的書沒有還,列出這些讀者的基本信息三、實驗的環(huán)境:1、硬件環(huán)境:CPU: Intel(R) Core i5-3230 2.60GHz RAM: 8GB2、軟件環(huán)境:操作系統(tǒng):Windows 7 Ultimate SP1 編譯軟件:Eclipse Lu

4、na Microsoft SQL Server 2014四、系統(tǒng)ER圖五、表結(jié)構定義(使用表格說明)六、系統(tǒng)功能模塊1) 能夠通過書籍基本信息單個或組合多個條件查詢書籍信息;2) 對于每一種書籍,除可查看其基本信息之外還可查看其總數(shù)以及目前在館數(shù)量3) 可增添新的書籍4) 可刪除已有書籍(如有讀者借了該書籍尚未歸還,則不允許刪除)5) 可修改書籍的基本信息6) 能夠通過讀者基本信息單個或組合多個條件查詢讀者信息7) 對于每位讀者除可查看其基本信息之外,還可查看其已借的書籍列表、數(shù)量、借還日期8) 可增添新的讀者9) 可刪除已有讀者(如該讀者有尚未歸還的借書,則不允許刪除)10) 可修改讀者的基

5、本信息11) 可完成借還書籍的手續(xù)12) 還書時如超期,應該顯示超期天數(shù)13) 借書時如果有超期的書沒有還,則不允許借書14) 可查詢有哪些讀者有超期的書沒有還,列出這些讀者的基本信息七、程序框架流程圖九、程序運行結(jié)果八、核心代碼AddBook.javaimport java.awt.BorderLayout;import java.awt.Container;import java.awt.GridLayout;import java.awt.event.*;import java.util.ArrayList;import javax.swing.*;public class AddBoo

6、k 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:"

7、;);JLabel 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 wi

8、th Storage");JTextField numberField = new JTextField();JTextField nameField = new JTextField();JTextField authorField = new JTextField();JTextField pressField = new JTextField();JTextField pressTimeField = new JTextField();JTextField abstractField = new JTextField();JTextField storageField = ne

9、w JTextField();JButton cancel = new JButton("Cancel");JButton confirm = new JButton("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

10、.add(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(remain1);p1.add(cancel);p1.add(confirm);cancel.addActionListener(this);confirm.addActionListener(this);pub

11、lic void actionPerformed(ActionEvent e) / TODO Auto-generated method stubif (e.getSource() = cancel) this.dispose();if (e.getSource() = confirm) this.dispose();BookInfo book = new BookInfo(numberField.getText(),nameField.getText(), authorField.getText(),pressField.getText(), pressTimeField.getText()

12、,abstractField.getText(), Integer.parseInt(storageField.getText(),Integer.parseInt(storageField.getText();ArrayList<String> strArray = new ArrayList<String>();strArray = op.addBookJudgement();int n = 0;int replicate = 0;while (n < Integer.parseInt(strArray.get(0) n+;if (numberField.ge

13、tText().equals(strArray.get(n) replicate+;if (replicate = 0) op.saveBook(book);JOptionPane.showMessageDialog(null, "Add a book successfully!","Information", JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog(null,"This book(number) has already existed!"

14、;, "Warning",JOptionPane.INFORMATION_MESSAGE);AddReader.javaimport java.awt.BorderLayout;import java.awt.Container;import java.awt.GridLayout;import java.awt.event.*;import java.util.ArrayList;import javax.swing.*;public class AddReader extends JFrame implements ActionListener SQLOperation

15、 op = new SQLOperation();Container c = getContentPane();JPanel p1 = new JPanel();JLabel readerNumber = new JLabel("Reader Number:");JLabel readerName = new JLabel("Reader Name:");JLabel sex = new JLabel("Sex:");JLabel dpt = new JLabel("Department:");JLabel gra

16、de = new JLabel("Grade:");JTextField numberField = new JTextField();JTextField nameField = new JTextField();JTextField sexField = new JTextField();JTextField dptField = new JTextField();JTextField gradeField = new JTextField();JButton cancel = new JButton("Cancel");JButton confir

17、m = 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.add(grade);p1.add(gradeField);p1

18、.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 reader = new ReaderInfo(numberFiel

19、d.getText(),nameField.getText(), sexField.getText(),dptField.getText(), Integer.parseInt(gradeField.getText();ArrayList<String> strArray = new ArrayList<String>();strArray = op.addReaderJudgement();int n = 0;int replicate = 0;while (n < Integer.parseInt(strArray.get(0) n+;if (numberFi

20、eld.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

21、", JOptionPane.INFORMATION_MESSAGE); else op.saveReader(reader);JOptionPane.showMessageDialog(null,"Add a reader successfully!", "Information",JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog(null,"This reader(number) has already existed!", &quo

22、t;Warning",JOptionPane.INFORMATION_MESSAGE);BookDetails.javaimport java.awt.BorderLayout;import java.awt.Container;import 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

23、 BookDetails extends JFrame implements ActionListener SQLOperation op = new SQLOperation();Container c = getContentPane();JPanel p1 = new JPanel();JPanel p2 = new JPanel();JPanel p3 = new JPanel();JLabel bookNumber = new JLabel("Book Number:");JLabel bookName = new JLabel("Book Name:&

24、quot;);JLabel author = new JLabel("Author:");JLabel press = new JLabel("Press:");JLabel pressTime = new JLabel("Press time:");JLabel bookAbstract = new JLabel("Abstract:");JLabel storage = new JLabel("Storage:");JLabel remain = new JLabel("Remai

25、n:");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 storageField = new JLabel();JLabel remainField = new JLabel();JButton cancel

26、= 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 = new J

27、ScrollPane(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.setMo

28、del(books);table.invalidate();ArrayList<String> strArray = new ArrayList<String>();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);ab

29、stractField.setText(strArray.get(5);storageField.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

30、.add(nameField);p1.add(author);p1.add(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(

31、scrollPane);p3.add(cancel);table.setPreferredScrollableViewportSize(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,

32、name, author, press, pressTime, bookAbstract;private int total, remain;/ default constructorpublic BookInfo() public BookInfo(String number) this.number = number;public BookInfo(String number, String name) this.number = number; = name;public BookInfo(String number, String name, String autho

33、r, String press,String pressTime, String bookAbstract, int total, int remain) this.number = number; = 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;p

34、ublic String getNumber() return number;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 get

35、Remain() return remain;BookRetrieval.javaimport 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 BookRetri

36、eval extends JFrame implements ActionListener 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:");J

37、TextField number = new JTextField();JTextField name = new JTextField();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");JButto

38、n search = new JButton("Search for details!");JButton borrowBook = new JButton("Borrow a book");JButton returnBook = new JButton("Return a book");Font font1 = new Font("00", Font.BOLD, 20);Object s = "Number", "Name", "Author", &q

39、uot;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 BookInfo();ob = op.allBook(book);for (int i = 0

40、; 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, BorderLayout.SOUTH);search.setFont(font

41、1);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(bookNumber);p5.add(number);p5.

42、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);borrowBook.addActionListener(this

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

44、lt; Integer.parseInt(strArray.get(0) n+;if (s1.equals(strArray.get(n) replicate+;ArrayList<String> strArray1 = new ArrayList<String>();strArray1 = op.addBookJudgement1();int n1 = 0;int replicate1 = 0;while (n1 < Integer.parseInt(strArray1.get(0) n1+;if (s2.equals(strArray1.get(n1) rep

45、licate1+;if (replicate = 0 && replicate1 = 0) JOptionPane.showMessageDialog(null,"Please input a correct book number or name!","Warning", JOptionPane.INFORMATION_MESSAGE); else if (replicate != 0 | replicate1 != 0) if (replicate = 0 && replicate1 != 0) BookInfo bo

46、ok = new BookInfo(s1, s2);String s = op.searchBookByName(book);BookDetails f = new BookDetails(s);/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Book Details");f.setLocation(300, 200);f.setSize(480, 470);f.setVisible(true); else if (replicate != 0) BookDetails f = new BookD

47、etails(s1);/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Book Details");f.setLocation(300, 200);f.setSize(480, 470);f.setVisible(true);if (e.getSource() = back) this.dispose();MyFrame f = new MyFrame();/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Lib

48、rary Management System");f.setLocation(300, 200);f.setSize(580, 300);f.setVisible(true);if (e.getSource() = addBook) AddBook f = new AddBook();/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Add a book");f.setLocation(300, 200);f.setSize(300, 400);f.setVisible(true);if

49、(e.getSource() = deleteBook) DeleteBook f = new DeleteBook();/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Delete a book");f.setLocation(300, 200);f.setSize(300, 200);f.setVisible(true);if (e.getSource() = borrowBook) BorrowBook f = new BorrowBook();/ f.setDefaultCloseOper

50、ation(JFrame.EXIT_ON_CLOSE);f.setTitle("Borrow a book");f.setLocation(300, 200);f.setSize(300, 200);f.setVisible(true);if (e.getSource() = returnBook) ReturnBook f = new ReturnBook();/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Return a book");f.setLocation(300,

51、 200);f.setSize(300, 200);f.setVisible(true);if (e.getSource() = editBook) SelectEdit f = new SelectEdit();/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);f.setTitle("Edit a book");f.setLocation(300, 200);f.setSize(300, 200);f.setVisible(true);BorrowBook.javaimport java.awt.BorderLayout

52、;import java.awt.Container;import java.awt.GridLayout;import java.awt.event.*;import java.util.ArrayList;import javax.swing.*;public class BorrowBook extends JFrame implements ActionListener SQLOperation op = new SQLOperation();Container c = getContentPane();JPanel p1 = new JPanel();JLabel bookNumbe

53、r = new JLabel("Book Number:");JTextField numberField = new JTextField();JLabel readerNumber = new JLabel("Reader Number:");JTextField readerNumberField = new JTextField();JButton cancel = new JButton("Cancel");JButton borrow = new JButton("Borrow!");public BorrowBook() c.add(p1, BorderLayout.NORTH);p1.setLayout(new GridLayout(3, 2, 20, 10);p1.add(bookNumber);p1.add(numberField);p1.add(readerNumber);p1.add(readerNumberField);p1.add(cancel);p1.add

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論