真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

書城系統(tǒng)的Java代碼,網(wǎng)上書店java代碼

求一個(gè)java圖書管理系統(tǒng)代碼,不需要圖形化,命令行就可以,只要求實(shí)現(xiàn)導(dǎo)入圖書,查詢,刪除

import?java.io.BufferedReader;

公司主營業(yè)務(wù):成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、移動(dòng)網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出墨玉免費(fèi)做網(wǎng)站回饋大家。

import?java.io.File;

import?java.io.FileReader;

import?java.util.ArrayList;

import?java.util.List;

import?java.util.Scanner;

public?class?BookWork?{

static?ListBook?data;

private?static?Scanner?input;

public?static?void?main(String[]?args)?{

if?(!initBook("d:/book.txt"))?{

System.out.println("初始圖書列表失敗?..");

return;

}

input?=?new?Scanner(System.in);

while?(true)?{

try?{

System.out.println("請(qǐng)輸入操作:");

System.out.println("1.找書??2.刪除圖書?3.退出");

int?number?=?Integer.parseInt(input.next());

if?(number?==?1)?{

findBook();

}?else?if?(number?==?2)?{

delBook();

}?else?if?(number?==?3)?{

System.out.println("退出");

break;

}?else?{

System.out.println("這個(gè)不是我要的...重來...");

System.out.println();

}

}?catch?(Exception?e)?{

e.printStackTrace();

System.out.println("這個(gè)不是我要的...重來...");

System.out.println();

}

}

}

private?static?void?delBook()?{

System.out.println("請(qǐng)輸入要?jiǎng)h除的書名或編號(hào):");

String?key?=?input.next();

if?(key?!=?null??!key.equals(""))?{

for?(Book?book?:?data)?{

if?(book.number.equals(key)?||?book.name.contains(key))?{

data.remove(book);

System.out.println("?圖書?"?+?book.toString()?+?"?已刪除");

return;

}

}

}

System.out.println("沒有您要?jiǎng)h除的");

}

private?static?void?findBook()?{

System.out.println("請(qǐng)輸入要查找的書名或編號(hào):");

String?key?=?input.next();

if?(key?!=?null??!key.equals(""))?{

for?(Book?book?:?data)?{

if?(book.number.equals(key)?||?book.name.contains(key))?{

System.out.println("找到了?圖書?"?+?book.toString());

return;

}

}

}

System.out.println("沒有您要找的");

}

private?static?boolean?initBook(String?string)?{

try?{

System.out.println("圖書導(dǎo)入中...");

System.out.println("列表文件?--?"?+?string);

File?file?=?new?File(string);

if?(!file.exists())?{

return?false;

}

data?=?new?ArrayListBook();

BufferedReader?bufferedReader?=?new?BufferedReader(new?FileReader(file));

String?line?=?"";

while?((line?=?bufferedReader.readLine())?!=?null)?{

String[]?strings?=?line.split(",");

Book?b?=?new?Book(strings[0],?strings[1]);

data.add(b);

System.out.println("導(dǎo)入"?+?b.toString());

}

}?catch?(Exception?e)?{

e.printStackTrace();

return?false;

}

return?true;

}

public?static?class?Book?{

String?number;

String?name;

public?Book(String?number,?String?name)?{

super();

this.number?=?number;

this.name?=?name;

}

@Override

public?String?toString()?{

return?"Book?[編碼:"?+?number?+?",?名稱:"?+?name?+?"]";

}

}

}

001,金瓶梅

002,雜事秘辛

003,飛燕外傳

004,控鶴監(jiān)秘記

005,漢宮春色

用java編寫一個(gè) 圖書館圖書借閱管理系統(tǒng)

---------------------------------------------------

給你修改了三個(gè)地方:

1.borrowBooks方法中,將System.out.println("你要借嗎?"); 改為:

System.out.println("你要借嗎?輸入1表示借,其他數(shù)字表示不借。");

保證輸入的時(shí)候輸入的數(shù)字,否則會(huì)報(bào)出異常。

2.borrowBooks方法中,將self[score] = all[9]; 改為:self[score] = all[i];

如果是all[9],那么就始終是最后一本書籍信息了。

3.have方法中,你是想將所借的書籍信息都打印出來。修改的比較多,下面注釋代碼是原來的。

void have(Books[] self) {

// for (int i = 0; i 2; i++) {

// self[i].showBookInfo();

// }

for (int i = 0; i 3; i++) {

if(self[i]!=null)

self[i].showBookInfo();

}

}

****************** 附上所有代碼:*************************

import java.util.Scanner;

public class TestBook {

public static void main(String[] args) {

Books all[] = new Books[10];

Books self[] = new Books[3];

all[0] = new Books("java", 1, "12345", "tom", 34.0f, "人民出版社");

all[1] = new Books("c", 2, "12346", "tnn", 31.0f, "人民出版社");

all[2] = new Books("c++", 3, "12445", "mm", 35.0f, "人民出版社");

all[3] = new Books("c#", 4, "12365", "tt", 38.0f, "人民出版社");

all[4] = new Books("j2se", 5, "13345", "tosm", 31.1f, "人民出版社");

all[5] = new Books("j2ee", 6, "18345", "ttm", 32.0f, "人民出版社");

all[6] = new Books("jsp", 7, "12335", "cc", 33.0f, "人民出版社");

all[7] = new Books("net", 8, "12341", "bb", 36.0f, "人民出版社");

all[8] = new Books("ip", 9, "12343", "aa", 37.0f, "人民出版社");

all[9] = new Books("tcp", 10, "22345", "jj", 39.0f, "人民出版社");

Readers r = new Readers("xiaoming", 101, "1", 3);

r.searchAllBooks(all);

r.borrowBooks(all, self);

r.have(self);

r.give(all, self);

}

}

class Readers {

Scanner scan = new Scanner(System.in);

String names;

int nums;

String classes;

int grade;

int score = 0;

// Books self[]=new Books[3];

Readers(String n, int u, String c, int g) {

names = n;

nums = u;

classes = c;

grade = g;

}

void searchAllBooks(Books[] all) {// 查書

for (int i = 0; i 10; i++)

all[i].showBookInfo();

// self[score]=all[0];

}

void give(Books[] all, Books[] self) {// 還書

System.out.println("請(qǐng)輸入您要還的書的書號(hào)");

int n = scan.nextInt();

for (int i = 0; i 10; i++) {

if (n == all[i].num) {

for (int j = 0; j 3; j++) {

if (self[j] == all[i]) {

self[j] = null;

System.out.println("還書成功");

}

}

}

}

}

void have(Books[] self) {

// for (int i = 0; i 2; i++) {

// self[i].showBookInfo();

// }

for (int i = 0; i 3; i++) {

if(self[i]!=null)

self[i].showBookInfo();

}

}

void giveMoney() {

}

void borrowBooks(Books[] all, Books[] self) {

System.out.println("請(qǐng)輸入您要查找的書名:");

String n = scan.next();

int i;

for (i = 0; i 10; i++) {

if (n.equals(all[i].name)) {

all[i].showBookInfo();

break;

}

}

//System.out.println("你要借嗎?");

System.out.println("你要借嗎?輸入1表示借,其他數(shù)字表示不借。");

int j;

j = scan.nextInt();

if (j == 1) {

System.out.println("借閱成功");

//self[score] = all[9];

self[score] = all[i];

score += 1;

}

if (score 4) {

System.out.println("您還可以借閱" + (3 - score) + "本");

} else {

System.out.println("對(duì)不起,一個(gè)人只能借3本");

}

}

}

class Books {

String name;

int num;

String ISBN;

String writer;

float price;

String publisher;

Books(String n, int u, String i, String w, float p, String l) {

name = n;

num = u;

ISBN = i;

writer = w;

price = p;

publisher = l;

}

void showBookInfo() {

System.out.println("**************************");

System.out.println("書名:" + name);

System.out.println("索書號(hào):" + num);

System.out.println("ISBN號(hào):" + ISBN);

System.out.println("價(jià)格:" + price);

System.out.println("出版社:" + publisher);

System.out.println("**************************");

}

}

----------------------------------------------------

java圖書管理界面系統(tǒng)的源代碼

java swing 登陸界面code

/*

* Login.java

*

* Created on __DATE__, __TIME__

*/

package com.agen.library.window;

import java.awt.Image;

import java.awt.Toolkit;

import javax.swing.JOptionPane;

import javax.swing.UIManager;

import javax.swing.UnsupportedLookAndFeelException;

import com.agen.library.factory.DAOFactory;

import com.agen.library.util.GlobalUser;

import com.agen.library.vo.User;

/**

*

* @author __USER__

*/

public class Login extends javax.swing.JFrame {

/**

*

*/

private static final long serialVersionUID = -2176093732040600809L;

/** Creates new form Login */

public Login() {

super("易云圖書管理軟件V1.0");

Image ime = Toolkit.getDefaultToolkit().getImage(

getClass().getResource("/images/ico.png"));

try {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

} catch (ClassNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InstantiationException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IllegalAccessException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (UnsupportedLookAndFeelException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

setIconImage(ime);

initComponents();

setLocationRelativeTo(null);

this.setResizable(false);

}

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

// GEN-BEGIN:initComponents

// editor-fold defaultstate="collapsed" desc="Generated Code"

private void initComponents() {

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();

jPasswordField1 = new javax.swing.JPasswordField();

jButton1 = new javax.swing.JButton();

jButton2 = new javax.swing.JButton();

jLabel1 = new javax.swing.JLabel();

jMenuBar1 = new javax.swing.JMenuBar();

jMenu1 = new javax.swing.JMenu();

jMenuItem1 = new javax.swing.JMenuItem();

jMenu2 = new javax.swing.JMenu();

jMenuItem2 = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

addKeyListener(new java.awt.event.KeyAdapter() {

public void keyPressed(java.awt.event.KeyEvent evt) {

formKeyPressed(evt);

}

public void keyTyped(java.awt.event.KeyEvent evt) {

formKeyTyped(evt);

}

});

jLabel2.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jLabel2.setText("\u7528\u6237\u540d\uff1a");

jLabel3.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jLabel3.setText("\u5bc6 \u7801\uff1a");

jTextField1.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jTextField1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jTextField1ActionPerformed(evt);

}

});

jPasswordField1.setFont(new java.awt.Font("微軟雅黑", 0, 12));

jPasswordField1.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyTyped(java.awt.event.KeyEvent evt) {

jPasswordField1KeyTyped(evt);

}

});

jButton1.setBackground(new java.awt.Color(223, 216, 216));

jButton1.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jButton1.setText("\u767b\u9646");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

}

});

jButton2.setBackground(new java.awt.Color(223, 216, 216));

jButton2.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jButton2.setText("\u53d6\u6d88");

jButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton2ActionPerformed(evt);

}

});

jLabel1.setIcon(new javax.swing.ImageIcon(

getClass().getResource("/images/login_main.jpg"))); // NOI18N

jMenu1.setText("File");

jMenu1.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(

java.awt.event.KeyEvent.VK_Q,

java.awt.event.InputEvent.CTRL_MASK));

jMenuItem1.setText("Exit");

jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jMenuItem1MouseClicked(evt);

}

});

jMenuItem1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenuItem1ActionPerformed(evt);

}

});

jMenu1.add(jMenuItem1);

jMenuBar1.add(jMenu1);

jMenu2.setText("Help");

jMenu2.setFont(new java.awt.Font("微軟雅黑", 0, 14));

jMenuItem2.setText("About");

jMenuItem2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenuItem2ActionPerformed(evt);

}

});

jMenu2.add(jMenuItem2);

jMenuBar1.add(jMenu2);

setJMenuBar(jMenuBar1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(

getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(layout

.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel1)

.addGroup(

layout.createSequentialGroup()

.addContainerGap()

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.TRAILING,

false)

.addComponent(

jLabel2,

javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(

javax.swing.GroupLayout.Alignment.LEADING,

layout.createSequentialGroup()

.addComponent(

jLabel3)

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(

layout.createSequentialGroup()

.addGap(10,

10,

10)

.addComponent(

jButton1)

.addGap(47,

47,

47)

.addComponent(

jButton2))

.addComponent(

jPasswordField1)

.addComponent(

jTextField1,

javax.swing.GroupLayout.DEFAULT_SIZE,

197,

Short.MAX_VALUE))

.addContainerGap()))));

layout.setVerticalGroup(layout

.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(

layout.createSequentialGroup()

.addComponent(jLabel1)

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel2)

.addComponent(

jTextField1,

javax.swing.GroupLayout.PREFERRED_SIZE,

24,

javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel3)

.addComponent(

jPasswordField1,

javax.swing.GroupLayout.PREFERRED_SIZE,

23,

javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton1)

.addComponent(jButton2))

.addContainerGap(

javax.swing.GroupLayout.DEFAULT_SIZE,

Short.MAX_VALUE)));

pack();

}// /editor-fold

// GEN-END:initComponents

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

About.start();

}

private void jPasswordField1KeyTyped(java.awt.event.KeyEvent evt) {

if (evt.getKeyChar() == '\n') {

String name = jTextField1.getText(); // 獲取用戶名

String pass = String.valueOf(jPasswordField1.getPassword());// 獲取密碼

User user = null;

// 未輸入用戶名

if (name.equals("") || name == null) {

JOptionPane.showMessageDialog(this, "用戶名不允許為空!", "cuowu", 0);

return;

}

try {

user = DAOFactory.getIUserDAOInstance().findById(name);

if (user != null) {

if (user.getPass() != null user.getPass().equals(pass)) {

GlobalUser.LOGIN_USER = user; // 記錄當(dāng)前用戶

// 進(jìn)入主界面

Main.start();

this.dispose();

} else {

JOptionPane.showMessageDialog(this, "用戶名或密碼錯(cuò)誤!");

return;

}

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

if (user == null) {

JOptionPane.showMessageDialog(this, "用戶名或密碼錯(cuò)誤!", "消息", 0);

return;

}

}

}

private void formKeyTyped(java.awt.event.KeyEvent evt) {

}

private void formKeyPressed(java.awt.event.KeyEvent evt) {

}

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jPasswordField1.setText("");

jTextField1.requestFocus();

}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

String name = jTextField1.getText(); // 獲取用戶名

String pass = String.valueOf(jPasswordField1.getPassword());// 獲取密碼

User user = null;

// 未輸入用戶名

if (name.equals("")) {

JOptionPane.showMessageDialog(this, "用戶名不允許為空!");

return;

}

try {

user = DAOFactory.getIUserDAOInstance().findById(name);

if (user != null) {

if (user.getPass() != null user.getPass().equals(pass)) {

GlobalUser.LOGIN_USER = user; // 記錄當(dāng)前用戶

// 進(jìn)入主界面

Main.start();

this.dispose();

} else {

JOptionPane.showMessageDialog(this, "用戶名或密碼錯(cuò)誤!", "消息", 0);

return;

}

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

if (user == null) {

JOptionPane.showMessageDialog(this, "用戶名或密碼錯(cuò)誤!", "消息", 0);

return;

}

}

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {

if (JOptionPane.showConfirmDialog(this, "你確定要退出嗎?", "提示",

JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

System.exit(0);

}

}

private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt) {

System.exit(1);

}

/**

* @param args

* the command line arguments

*/

public static void main(String args[]) {

// System.out.println(Login.class.getResource("src/images/images/login_main.jpg"));

// new javax.swing.ImageIcon(

// Login.class.getResource("../../../../images/login_main.jpg"));

// new Login().setVisible(true);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Login().setVisible(true);

}

});

}

// GEN-BEGIN:variables

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JMenu jMenu1;

private javax.swing.JMenu jMenu2;

private javax.swing.JMenuBar jMenuBar1;

private javax.swing.JMenuItem jMenuItem1;

private javax.swing.JMenuItem jMenuItem2;

private javax.swing.JPasswordField jPasswordField1;

private javax.swing.JTextField jTextField1;

// End of variables declaration//GEN-END:variables

}

用java編寫一個(gè)電子書店程序

懸賞什么的不值錢的,沒人愿意花時(shí)間做這個(gè)的,推薦CSDN網(wǎng)站自己找找類似的,然后改改,如果改的能力都沒有的話,那也就沒辦法了


網(wǎng)頁名稱:書城系統(tǒng)的Java代碼,網(wǎng)上書店java代碼
文章轉(zhuǎn)載:http://weahome.cn/article/hoiggp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部