java图书购买系统代码 javaweb网上图书商城源码

求java的图书购买系统,最好是新做的可以运行的完整代码, 毕业做,我已经崩溃了,一定要用javajava图书购买系统代码的桌面程序做java图书购买系统代码?不死才怪呢 。如果可以用web框架做java图书购买系统代码,快多了 。哎java图书购买系统代码 , 中国的大学教育……问问老师能不能用web框架做,不过楼主也得会框架才行……你自己觉得难,别人也难啊 , 试问哪有现成的呢?
图书管理系统Java oracle代码至少要100分,才行java图书购买系统代码的这样java图书购买系统代码的系统,要代码需要半天java图书购买系统代码的时间.
用JAVA编写购物系统的代码是什么?(急)算是最简单的吧
package cn.job01;
import java.util.Scanner;
public class Lx07 {
public static void choice() {
System.out.println("登陆菜单");
System.out.println("1登陆系统");
System.out.println("2退出");
}
static void choice1() {
System.out.println("购物管理系统客户信息");
System.out.println("1显示所有客户信息");
System.out.println("2添加客户信息");
System.out.println("3修改客户信息");
System.out.println("4查询客户信息");
}
static void choice2() {
System.out.println("购物管理系统真情回馈");
System.out.println("1幸运大放送");
System.out.println("2幸运抽奖");
System.out.println("3生日问候");
}
public static void main(String[] args) {
choice();
Scanner input = new Scanner(System.in);
System.out.println("请输入1or2");
int num = input.nextInt();
switch (num) {
case 1:
System.out.println("主菜单");
System.out.println("1客户信息管理");
System.out.println("2购物结算");
System.out.println("3真情回馈");
System.out.println("4注销");
break;
}
System.out.println("选择输入数字");
int num1 = input.nextInt();
switch (num1) {
case 1:
choice1();
break;
case 2:
System.out.println("购物结算");
break;
case 3:
choice2();
break;
case 4:
choice();
break;
}
}
}
图书管理系统用java语言 1:输入5本书 书名,书号,价格 2:计算书的总价格,平均价格 3package test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class BookShow {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("请输入第一本书名、书号、价格(输入时用*隔开,例:红楼梦*1001*100):");
String str1=sc.next();
Book book1=BookShow.ReturnBook(str1);
System.out.println("请输入第二本书名、书号、价格(输入时用*隔开,例:红楼梦*1001*100):");
String str2=sc.next();
Book book2=BookShow.ReturnBook(str2);
System.out.println("请输入第三本书名、书号、价格(输入时用*隔开,例:红楼梦*1001*100):");
String str3=sc.next();
Book book3=BookShow.ReturnBook(str3);
System.out.println("请输入第四本书名、书号、价格(输入时用*隔开,例:红楼梦*1001*100):");
String str4=sc.next();
Book book4=BookShow.ReturnBook(str4);
System.out.println("请输入第五本书名、书号、价格(输入时用*隔开 , 例:红楼梦*1001*100):");
String str5=sc.next();
Book book5=BookShow.ReturnBook(str5);
ListBook books=new ArrayListBook();
books.add(book1);
books.add(book2);
books.add(book3);
books.add(book4);
books.add(book5);
System.out.println("----------------------------------------------");
double sumprice=book1.getPrice() book2.getPrice() book3.getPrice() book4.getPrice() book5.getPrice();
System.out.println("五本书的总价格为:" sumprice);
double avgprice=sumprice/5;
System.out.println("五本书的平均价格为:" avgprice);
ListDouble prices=new ArrayListDouble();
prices.add(book1.getPrice());
prices.add(book2.getPrice());
prices.add(book3.getPrice());
prices.add(book4.getPrice());
prices.add(book5.getPrice());
Collections.sort(prices);
System.out.println("价格最高的为:" prices.get(4) "价格最低的为:" prices.get(0));
ListBook books2=new ArrayListBook();
ListBook books3=new ArrayListBook();
for(Book b:books){
if(b.getPrice()avgprice){
books2.add(b);
}else if(b.getPrice()avgprice){
books3.add(b);
}
}
System.out.println("高于平均价格的书有:" BookShow.toShow(books2));
System.out.println("低于平均价格的书有:" BookShow.toShow(books3));
System.out.println("----------------------------------------------");
while(true){
System.out.println("请输入书号查询书籍(输入0退出):");
int bookId=sc.nextInt();
if(bookId==0){
break;
}else{
Book book=new Book();
for(Book b:books){
if(bookId==b.getBookId()){
book=b;
}
}
System.out.println("当前书籍为:书名" book.getName() ",书号" book.getBookId() ",价格" book.getPrice());
}
}
}
public static Book ReturnBook(String str){
Book book=new Book(str.substring(0, str.indexOf("*")),
str.substring(str.indexOf("*") 1,str.lastIndexOf("*")),
str.substring(str.lastIndexOf("*") 1,str.length()));
return book;
}
public static String toShow(ListBook books){
String str="";
for(Book b:books){
str =b.getName() "";
}
return str;
}
}
class Book{
private String name;
private double price;
private int bookId;
public Book(){}
public Book(String name,String bookId,String price){
this.name=name;
this.price=Double.parseDouble(price);
this.bookId=Integer.parseInt(bookId);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
}
JAVA编程图书管理系统购物车楼主 最简单的就是把 用户放入购物车的商品编号 存入到session
你可以做一类 属性 id//商品编号 num //购买数量 name //商品名称 price //商品价格简单的就这样用就差不多
点击放入购物车 你可以用ajaxsession.setAttribute("定义名称",放入商品对象); //你可以在这判断下如果存在你就把 num 1;
点击查看购物车 你就把sesssion.getAttribute("定义名称") 循环出来就可以了 总价格就把 num*price
所有总价格就循环时 把总价格加在一起即可
你用百度hi我发送给你
求图书管理系统(java)代码?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("用户名:");
jLabel3.setFont(new java.awt.Font("微软雅黑", 0, 14));
jLabel3.setText("密码:");
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("登陆");
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("取消");
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() != nulluser.getPass().equals(pass)) {
GlobalUser.LOGIN_USER = user; // 记录当前用户
// 进入主界面
Main.start();
this.dispose();
} else {
JOptionPane.showMessageDialog(this, "用户名或密码错误!");
return;
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (user == null) {
JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 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() != nulluser.getPass().equals(pass)) {
GlobalUser.LOGIN_USER = user; // 记录当前用户
// 进入主界面
Main.start();
this.dispose();
} else {
JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 0);
return;
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (user == null) {
JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 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图书购买系统代码 javaweb网上图书商城源码】java图书购买系统代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于javaweb网上图书商城源码、java图书购买系统代码的信息别忘了在本站进行查找喔 。

    推荐阅读