《java书店管理系统源代码(共11页).doc》由会员分享,可在线阅读,更多相关《java书店管理系统源代码(共11页).doc(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上 Java 源代码public class loaduser public String user; public String password; boolean b1; loaduser(String s1,String s2) user=s1; password=s2; void load() System.out.println( 书店管理销售系统); System.out.println(*); System.out.println( 1、登录系统); System.out.println( 2、退出系统); System.out.println(*); S
2、ystem.out.println(请选择:); int m; Scanner s=new Scanner(System.in); m=s.nextInt(); if(m=1) for(int i=0;i3;i+) System.out.println(请输入账户名和密码); String s3,s4; Scanner ss=new Scanner(System.in); s3=s.next(); s4=s.next(); if(user.equals(s3)&password.equals(s4) b1=true ; else b1=false; if(i=0&b1=false)System
3、.out.println(用户名或密码输入错误一次,还有两次机会!); if(i=1&b1=false)System.out.println(用户名或密码输入错误两次,还有一次机会!); if(i=2&b1=false)System.out.println(三次输入错误,退出系统!);System.exit(0); if(b1=true) System.out.println(登录成功!); break; if(m=2)System.exit(0); package manger;import java.util.ArrayList;import java.util.Scanner;impor
4、t manger.vip;import System.menu;public class vipmanger static ArrayList vipgroup=new ArrayList();public vipmanger() vipgroup.add(new vip(001,王芳,100); vipgroup.add(new vip(002,李娜,60); vipgroup.add(new vip(003,杨丽,50); vipgroup.add(new vip(004,孙洁,150); vipgroup.add(new vip(005,肖青,300); static void addd
5、() System.out.println(请一次输入编号,姓名,积分); String S1,S2; int A; Scanner s=new Scanner(System.in); S1=s.next(); S2=s.next(); A=s.nextInt(); vip v1=new vip (S1,S2,A); vipgroup.add(v1); static void delete() System.out.println(请输入要求删除的会员编号:); String s; Scanner me=new Scanner (System.in); s=me.next(); boolean
6、 b1=true; for(int i=0;ivipgroup.size();i+) if(s.equals(vipgroup.get(i).ID) vipgroup.remove(i); b1=false; if(b1)System.out.println(查无此会员!); static void correct() System.out.println(请输入要修改信息的会员编号:); String sss; Scanner s=new Scanner(System.in); sss=s.next(); boolean b1=true; for(int i=0;ivipgroup.size
7、();i+) if(sss.equals(vipgroup.get(i).ID) b1=false; System.out.println(请输入新的姓名和积分:); String ss1; Scanner s7=new Scanner(System.in); ss1=s7.next(); vipgroup.get(i).name=ss1; int b; Scanner s8=new Scanner(System.in); b=s8.nextInt(); vipgroup.get(i).score=b; if(b1=true)System.out.println(查无此会员!); static
8、 void select() System.out.println(请输入要查询的会员编号:); String s; Scanner me=new Scanner(System.in); s=me.next(); boolean b1=true ; for(int i=0;ivipgroup.size();i+) if (s.equals(vipgroup.get(i).ID)System.out.println(vipgroup.get(i).ID+ +vipgroup.get(i).name+ +vipgroup.get(i).score); b1=false ; if(b1=true)S
9、ystem.out.println(查无此会员!); static void show() for(int i=0;ivipgroup.size();i+) System.out.println(vipgroup.get(i).ID+ +vipgroup.get(i).name+ +vipgroup.get(i).score); public static void exchange(String s1,int a,int b) boolean b1=true; for(int i=0;ivipgroup.size();i+) if(s1.equals(vipgroup.get(i).ID)
10、if(vipgroup.get(i).score(a*b)System.out.println(积分不足,不能兑换!); else vipgroup.get(i).score-=a*b; b1=false; if(b1=true)System.out.println(查无此会员,不能兑换!); public static void shop(String s1,int a,int b) boolean b1=true; for( int i=0;ivipgroup.size();i+)if(s1.equals(vipgroup.get(i).ID)vipgroup.get(i).score+=
11、a*b; b1=false; if(b1=true)System.out.println(查无此会员,不能购买!); public static boolean start() menu m=new menu(); m.vip(); int x; Scanner me= new Scanner(System.in); x=me.nextInt(); switch(x) case 1:show();break; case 2:delete(); break; case 3:addd();break; case 4:correct();break; case 5:select();break; c
12、ase 6:return false; return true; public class book public String number; public String name; public int price; public int jf; book(String s1,String s2,int a,int b) number=s1; name=s2; price=a; jf=b; package manger;import java.util.ArrayList;import java.util.Scanner;import System.menu;public class bo
13、okmanger static ArrayList bookgroup=new ArrayList(); public bookmanger() bookgroup.add(new book(001,c语言,20,20); bookgroup.add(new book(002,大学英语,22,22); bookgroup.add(new book(003,高等数学,28,28); static void show() for(int i=0;ibookgroup.size();i+) System.out.println(bookgroup.get(i).number+ +bookgroup.
14、get(i).name+ +bookgroup.get(i).price+ +bookgroup.get(i).jf); static void addd() System.out.println(请依次输入书籍的编号,名称,价格,积分:); String S1,S2; int A,B; Scanner s=new Scanner(System.in); S1=s.next(); S2=s.next(); A=s.nextInt(); B=s.nextInt(); book b1=new book(S1,S2,A,B); bookgroup.add(b1); static void delet
15、e() System.out.println(请输入要删除的书籍编号:); String s11; Scanner me=new Scanner(System.in); s11=me.next(); boolean b1=true; for(int i=0;ibookgroup.size();i+) if(s11.equals(bookgroup.get(i).number) bookgroup.remove(i); b1=false; if(b1)System.out.println(查无此书!); public static int price(String s1 ) int a=0; i
16、nt i; for( i=0;ibookgroup.size();i+)if(s1.equals(bookgroup.get(i).number)a=bookgroup.get(i).price; return a; public static String name(String s1) String a = 无此书; for(int i=0;ibookgroup.size();i+)if(s1.equals(bookgroup.get(i).number)a=bookgroup.get(i).name; return a; public static boolean start() men
17、u m=new menu(); m.bookmanger(); int x; Scanner me= new Scanner(System.in); x=me.nextInt(); switch(x) case 1:show();break; case 2:delete();break; case 3:addd();break; case 4:return false; return true; public class gift public String number; public String caption ; public int costjf; gift(String s1,St
18、ring s2,int a) number=s1; caption=s2; costjf=a; package manger;import java.util.ArrayList;import java.util.Scanner;import manger.vipmanger;import manger.vip;import System.menu;import manger.gift;public class giftmanger static ArrayList giftgroup=new ArrayList();public giftmanger()giftgroup.add(new g
19、ift(001,鼠标垫,100);giftgroup.add(new gift(002,书夹子,50);giftgroup.add(new gift(003,中性笔,30); static void show() for(int i=0;igiftgroup.size();i+) System.out.println(giftgroup.get(i).number+ +giftgroup.get(i).caption+ +giftgroup.get(i).costjf); static void delete() System.out.println(请输入要删除的礼品编号:); String
20、 s; Scanner ss=new Scanner(System.in); s=ss.next();boolean b1=true; for(int i=0;igiftgroup.size();i+) if(s.equals(giftgroup.get(i).number) giftgroup.remove(i); b1=false; if(b1)System.out.println(查无此礼品!); static void addd() System.out.println(请输入要添加的礼品编号,名称,所需积分:); String s1,s2; int a; Scanner me=new
21、 Scanner(System.in); s1=me.next(); s2=me.next(); a=me.nextInt(); gift g1=new gift(s1,s2,a); giftgroup.add(g1); static void exchange() String s1,s2,c=无此礼品; int a,b=0; giftmanger.show(); Scanner me=new Scanner(System.in); System.out.println(请输入您的会员编号:); s1=me.next(); System.out.println(请输入您要兑换的礼品编号:);
22、 s2=me.next(); System.out.println(请输入您要兑换的礼品数量:); a=me.nextInt(); boolean b1=true; for(int i=0;i会员管理:); System.out.println(*); System.out.println(1、显示会员信息); System.out.println(2、删除会员); System.out.println(3、添加会员); System.out.println(4、修改会员信息); System.out.println(5、查询会员); System.out.println(6、返回上层菜单);
23、 System.out.println(*); public void bookmanger() System.out.println(书店管理系统书籍管理:); System.out.println(*); System.out.println(1、书籍信息查询); System.out.println(2、删除书籍); System.out.println(3、添加书籍); System.out.println(4、返回上层菜单); System.out.println(*); public void shopping() System.out.println(书店管理系统购物结算:);
24、System.out.println(*); System.out.println(1、购物); System.out.println(2、返回上层菜单); System.out.println(*); public void gift() System.out.println(书店管理系统礼品兑换:); System.out.println(*); System.out.println(1、礼品信息); System.out.println(2、删除礼品); System.out.println(3、添加礼品); System.out.println(4、兑换礼品); System.out.
25、println(5、返回上层菜单); System.out.println(*); public static void main(String args) loaduser u1=new loaduser(manger,); u1.load();menu m1=new menu();vipmanger vip=new vipmanger();bookmanger book=new bookmanger();giftmanger gi=new giftmanger(); while (true) m1.mainmenu(); int x; Scanner me=new Scanner(System.in); x=me.nextInt(); switch(x) case 1:while( vipmanger.start();break ; case 2:while(bookmanger.start();break; case 3:while(shoping.start();break; case 4:while(giftmanger.start();break; case 5:u1.load(); 专心-专注-专业
限制150内