ImageVerifierCode 换一换
格式:DOCX , 页数:37 ,大小:146.54KB ,
资源ID:3662292      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/3662292.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(#Java图书图书管理系统分析方案.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

#Java图书图书管理系统分析方案.docx

1、#Java图书图书管理系统分析方案成都信息项目学院计算机学院课 程 实 验 报 告实验课程:Java程序设计实验项目:图书管理系统指导教师:汤蓉学生姓名:向浩学生学号:2018051020班 级:计科111班实验地点:6306上交时间:2018年1月12实验成绩:一、 源代码import java.io.*。 public class Book implements Serializable/书的基类 public String author。/作者 public String published。/出版商 public String nameOfBook。/书名 private int Bo

2、oknumbers = 200。 public Book( public Book(String author,String published,String nameofBook this.author = author。 this.published = published。 this.nameOfBook = nameofBook。 private void writeObject(ObjectOutputStream out throws IOException out.writeUTF(author。 out.writeUTF(published。 out.writeUTF(name

3、OfBook。 private void readObject(ObjectInputStream in throws IOException author=in.readUTF(。 published=in.readUTF(。 nameOfBook=in.readUTF(。 private boolean bool = false。 public synchronized void borrowBook( if(bool try wait(。/多线程通信机制 catch(InterruptedException e System.out.println(Book类出现异常。 else boo

4、l = false。 Booknumbers-。 System.out.println(目前图书馆的馆藏图书一共有+Booknumbers+册。 notify(。/其他的线程被唤醒 public synchronized void returnBook( if(bool try wait(。/多线程通信机制 catch(InterruptedException e System.out.println(Book类出现异常。 else bool = true。 Booknumbers+。 System.out.println(目前图书馆的馆藏图书一共有+Booknumbers+册。 notify

5、(。/通知其他的线程被唤醒 public class BorrowedBookOutOfLimitException extends Exception /借书的数量超过了规定最大的数量抛出的异常public class BorrowThread implements Runnable Book book。 public BorrowThread(Book Bo book = Bo。 public void run( try book.borrowBook(。 Thread.sleep(10。 catch(InterruptedException io System.out.println(B

6、orrowThread出现异常。 import java.awt.*。import java.awt.Event.*。 import java.awt.event.MouseEvent。import java.awt.event.MouseListener。public class Button1Handler implements MouseListener public void mouseClicked(MouseEvent e UserLogin tft = new UserLogin(。 public void mouseEntered(MouseEvent e / Picture.

7、lb3.setText(你已经可以进行单击操作。 public void mousePressed(MouseEvent e / Picture.lb3.setText(你已按下按钮!。 public void mouseRelesed(MouseEvent e Override public void mouseReleased(MouseEvent e / TODO Auto-generated method stub Override public void mouseExited(MouseEvent e / TODO Auto-generated method stub import

8、 java.awt.event.ActionEvent。import java.awt.event.ActionListener。public class Button2Handler implements ActionListener public void actionPerformed(ActionEvent e System.exit(0。 import java.awt.*。import java.awt.Event.*。 import java.awt.event.MouseEvent。import java.awt.event.MouseListener。import java.

9、io.IOException。public class Button5Handler implements MouseListener public void mouseClicked(MouseEvent e MainTest Main = new MainTest(。 public void mouseEntered(MouseEvent e / Picture.lb3.setText(你已经可以进行单击操作。 public void mousePressed(MouseEvent e / Picture.lb3.setText(你已按下按钮!。 public void mouseRele

10、sed(MouseEvent e Override public void mouseReleased(MouseEvent e / TODO Auto-generated method stub Override public void mouseExited(MouseEvent e / TODO Auto-generated method stub import java.awt.event.FocusEvent。import java.awt.event.FocusListener。public class focusHandler implements FocusListener p

11、ublic void focusGainded(FocusEvent e public void focusLost(FocusEvent e Object ob = e.getSource(。 if(ob=UserLogin.txtName。 / System.out.println(UserLogin.txtName.getText(。 if(ob=UserLogin.txtPass / System.out.println(UserLogin.txtPass.getText(。 Override public void focusGained(FocusEvent e / TODO Au

12、to-generated method stub import java.awt.event.KeyEvent。import java.awt.event.KeyListener。public class keyHandler implements KeyListener public void keyPressed(KeyEvent e Object ob = e.getSource(。 if(ob=UserLogin.txtName&(e.getKeyCode(=10 / System.out.println(UserLogin.txtName.getText(。 else if(ob=U

13、serLogin.txtName&(e.getKeyCode(=10 / System.out.println(UserLogin.txtPass.getText(。 public void keyReleased(KeyEvent e public void keyTyped(KeyEvent e import java.io.*。public class Library extends Student public static int nowBooknumber= 0。 public String nameOfLibrary = CUIT Library。 public static i

14、nt nowStudentNumber = 0。 public Student STUDENT。 public Book booK。 public Library( STUDENT=new Student30。 booK = new Book20。 public void AddNewBook( throws IOException,ClassNotFoundException boolean change = true。 String tomp1,tomp2,tomp3,tomp5。 tomp1 = new String(。 tomp2 = new String(。 tomp3 = new

15、String(。 tomp5 = new String(。 while(change +nowBooknumber。 System.out.println(请输入加入图书的作者:。 try tomp1 = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catch block e.printStackTrace(。 System.out.println(请输入加入图书书名:。 try tomp2 = MainTest.initiate2(。 catch (IOException e / TODO Auto-gene

16、rated catch block e.printStackTrace(。 System.out.println(请输入加入图书的出版商:。 try tomp3 = MainTest.initiate2(。 catch (IOException e e.printStackTrace(。 booKnowBooknumber = new Book(tomp1,tomp2,tomp3。 MainTest.oos1.writeObject(booKnowBooknumber。 System.out.print(请问你还需要继续加入学生吗?1代表继续添加其他代表退出。 try tomp5 = Main

17、Test.initiate2(。 catch (IOException e e.printStackTrace(。 int middle = Integer.parseInt(tomp5.trim(。 if(middle = 1 change = true。 else change = false。 public Book displayBookInformation( throws IOException, ClassNotFoundException int j = 0。 FileInputStream fis = new FileInputStream(C:AddNewBook.txt。

18、 ObjectInputStream ois = new ObjectInputStream(fis。 try while(true booKj = (Bookois.readObject(。 System.out.println(图书名称:+booKj.author+图书出版商:+booKj.published+图书书名:+booKj.nameOfBook。 +j。 catch(Exception e nowBooknumber = j。 if(nowBooknumber System.out.println(你暂时还没有添加图书的相关的信息。 return null。 return boo

19、K。 /注:下面这个方法和上面这个方法是一样的,我们只是为了能够在Student类查找的时候能够用得到 public Book displayBookInformation1( throws IOException, ClassNotFoundException int j = 0。 FileInputStream fis = new FileInputStream(C:AddNewBook.txt。 ObjectInputStream ois = new ObjectInputStream(fis。 try while(true booKj = (Bookois.readObject(。/

20、System.out.println(图书名称:+booKj.author+图书出版商:+booKj.published+图书书名:+booKj.nameOfBook。 +j。 catch(Exception e nowBooknumber = j。 if(nowBooknumber System.out.println(你暂时还没有添加图书的相关的信息。 return null。 return booK。 public void addNewReader( throws IOException,NotSerializableException boolean change = true。 S

21、tring tomp1,tomp2,tomp3,tomp4,tomp5,number = null。 tomp1 = new String(。 tomp2 = new String(。 tomp3 = new String(。 tomp4 = new String(。 tomp5 = new String(。 while(change +nowStudentNumber。 System.out.println(请输入加入学生的姓名:。 try tomp1 = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catc

22、h block e.printStackTrace(。 System.out.println(请输入加入学生的性别:。 try tomp2 = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catch block e.printStackTrace(。 System.out.println(请输入加入学生的出生年月:。 try tomp3 = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catch block e.printSta

23、ckTrace(。 System.out.println(请输入加入学生的专业:。 try tomp4 = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catch block e.printStackTrace(。 System.out.println(请输入加入学生的学号:。 try number = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catch block e.printStackTrace(。 STUDENTno

24、wStudentNumber= new Student(tomp1,tomp2,tomp3,tomp4,number。 MainTest.oos2.writeObject(STUDENTnowStudentNumber。 System.out.print(请问你还需要继续加入学生吗?1代表继续添加其他代表退出。 try tomp5 = MainTest.initiate2(。 catch (IOException e / TODO Auto-generated catch block e.printStackTrace(。 int middle = Integer.parseInt(tomp5

25、.trim(。 if(middle = 1 change = true。 else change = false。 public void displayReaderInformation( throws IOException, ClassNotFoundException int j = 0。 FileInputStream fis1 = new FileInputStream(C:AddNewReader.txt。 ObjectInputStream ois1 = new ObjectInputStream(fis1。 try while(true STUDENTj = (Student

26、ois1.readObject(。 System.out.println(学生学号:+STUDENTj.studentNum+学生专业 :+STUDENTj.major+学生姓名 :+STUDENTj.name+学生性别: +STUDENTj.gender+出生日期:+STUDENTj.birthDate。 +j。 catch(Exception io nowStudentNumber = j。 if(nowStudentNumber System.out.println(你暂时还没有添加读者的相关的信息。 return 。 public void modifyInformation( throws IOException, ClassNotFoundException boolean change = true,chn = true。 String tomp1,tomp2,tomp3,tomp4,tomp5,tomp6,tomp7。 tomp1 = new String(。 tomp2 = new String(。 tomp3 = new String(。 tomp4 = new String(。 tomp5 = new Str

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1