java书店管理系统源代码.docx
- 文档编号:9477653
- 上传时间:2023-02-04
- 格式:DOCX
- 页数:18
- 大小:17.75KB
java书店管理系统源代码.docx
《java书店管理系统源代码.docx》由会员分享,可在线阅读,更多相关《java书店管理系统源代码.docx(18页珍藏版)》请在冰豆网上搜索。
java书店管理系统源代码
Java源代码
publicclassloaduser{
publicStringuser;
publicStringpassword;
booleanb1;
loaduser(Strings1,Strings2){
user=s1;
password=s2;
}
voidload(){
System.out.println("书店管理销售系统");
System.out.println("**************************************");
System.out.println("1、登录系统");
System.out.println("2、退出系统");
System.out.println("**************************************");
System.out.println("请选择:
");
intm;
Scanners=newScanner(System.in);
m=s.nextInt();
if(m==1){
for(inti=0;i<3;i++)
{
System.out.println("请输入账户名和密码");
Strings3,s4;
Scannerss=newScanner(System.in);
s3=s.next();
s4=s.next();
if(user.equals(s3)&&password.equals(s4))b1=true;
elseb1=false;
if(i==0&&b1==false)System.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);
}
packagemanger;
importjava.util.ArrayList;
importjava.util.Scanner;
importmanger.vip;
importSystem.menu;
publicclassvipmanger{
staticArrayList
publicvipmanger(){
vipgroup.add(newvip("001","王芳",100));
vipgroup.add(newvip("002","李娜",60));
vipgroup.add(newvip("003","杨丽",50));
vipgroup.add(newvip("004","孙洁",150));
vipgroup.add(newvip("005","肖青",300));
}
staticvoidaddd(){
System.out.println("请一次输入编号,姓名,积分");
StringS1,S2;
intA;
Scanners=newScanner(System.in);
S1=s.next();
S2=s.next();
A=s.nextInt();
vipv1=newvip(S1,S2,A);
vipgroup.add(v1);
}
staticvoiddelete(){
System.out.println("请输入要求删除的会员编号:
");
Strings;
Scannerme=newScanner(System.in);
s=me.next();
booleanb1=true;
for(inti=0;i if(s.equals(vipgroup.get(i).ID)) {vipgroup.remove(i); b1=false; } if(b1)System.out.println("查无此会员! "); } staticvoidcorrect(){ System.out.println("请输入要修改信息的会员编号: "); Stringsss; Scanners=newScanner(System.in); sss=s.next(); booleanb1=true; for(inti=0;i if(sss.equals(vipgroup.get(i).ID)){ b1=false; System.out.println("请输入新的姓名和积分: "); Stringss1; Scanners7=newScanner(System.in); ss1=s7.next(); vipgroup.get(i).name=ss1; intb; Scanners8=newScanner(System.in); b=s8.nextInt(); vipgroup.get(i).score=b; } if(b1==true)System.out.println("查无此会员! "); } staticvoidselect(){ System.out.println("请输入要查询的会员编号: "); Strings; Scannerme=newScanner(System.in); s=me.next(); booleanb1=true; for(inti=0;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)System.out.println("查无此会员! "); } staticvoidshow(){ for(inti=0;i System.out.println(vipgroup.get(i).ID+""+vipgroup.get(i).name+""+vipgroup.get(i).score); } publicstaticvoidexchange(Strings1,inta,intb){ booleanb1=true; for(inti=0;i if(s1.equals(vipgroup.get(i).ID)) {if(vipgroup.get(i).score<(a*b))System.out.println("积分不足,不能兑换! "); elsevipgroup.get(i).score-=a*b; b1=false; } if(b1==true)System.out.println("查无此会员,不能兑换! "); } publicstaticvoidshop(Strings1,inta,intb){ booleanb1=true; for(inti=0;i b1=false; } if(b1==true)System.out.println("查无此会员,不能购买! "); } publicstaticbooleanstart(){ menum=newmenu(); m.vip(); intx; Scannerme=newScanner(System.in); x=me.nextInt(); switch(x){ case1: show();break; case2: delete();break; case3: addd();break; case4: correct();break; case5: select();break; case6: returnfalse; } returntrue; } } publicclassbook{ publicStringnumber; publicStringname; publicintprice; publicintjf; book(Strings1,Strings2,inta,intb){ number=s1; name=s2; price=a; jf=b; } } packagemanger; importjava.util.ArrayList; importjava.util.Scanner; importSystem.menu; publicclassbookmanger{ staticArrayList publicbookmanger(){ bookgroup.add(newbook("001","c语言",20,20)); bookgroup.add(newbook("002","大学英语",22,22)); bookgroup.add(newbook("003","高等数学",28,28)); } staticvoidshow(){ for(inti=0;i System.out.println(bookgroup.get(i).number+""+bookgroup.get(i).name+""+bookgroup.get(i).price+""+bookgroup.get(i).jf); } staticvoidaddd(){ System.out.println("请依次输入书籍的编号,名称,价格,积分: "); StringS1,S2; intA,B; Scanners=newScanner(System.in); S1=s.next(); S2=s.next(); A=s.nextInt(); B=s.nextInt(); bookb1=newbook(S1,S2,A,B); bookgroup.add(b1); } staticvoiddelete(){ System.out.println("请输入要删除的书籍编号: "); Strings11; Scannerme=newScanner(System.in); s11=me.next(); booleanb1=true; for(inti=0;i if(s11.equals(bookgroup.get(i).number)) {bookgroup.remove(i); b1=false; } if(b1)System.out.println("查无此书! "); } publicstaticintprice(Strings1){ inta=0; inti; for(i=0;i returna; } publicstaticStringname(Strings1){ Stringa="无此书"; for(inti=0;i returna; } publicstaticbooleanstart(){ menum=newmenu(); m.bookmanger(); intx; Scannerme=newScanner(System.in); x=me.nextInt(); switch(x){ case1: show();break; case2: delete();break; case3: addd();break; case4: returnfalse; } returntrue; } } publicclassgift{ publicStringnumber; publicStringcaption; publicintcostjf; gift(Strings1,Strings2,inta){ number=s1; caption=s2; costjf=a; } } packagemanger; importjava.util.ArrayList; importjava.util.Scanner; importmanger.vipmanger; importmanger.vip; importSystem.menu; importmanger.gift; publicclassgiftmanger{ staticArrayList publicgiftmanger(){ giftgroup.add(newgift("001","鼠标垫",100)); giftgroup.add(newgift("002","书夹子",50)); giftgroup.add(newgift("003","中性笔",30)); } staticvoidshow(){ for(inti=0;i System.out.println(giftgroup.get(i).number+""+giftgroup.get(i).caption+""+giftgroup.get(i).costjf); } staticvoiddelete(){ System.out.println("请输入要删除的礼品编号: "); Strings; Scannerss=newScanner(System.in); s=ss.next(); booleanb1=true; for(inti=0;i if(s.equals(giftgroup.get(i).number)) {giftgroup.remove(i); b1=false; } if(b1)System.out.println("查无此礼品! "); } staticvoidaddd(){ System.out.println("请输入要添加的礼品编号,名称,所需积分: "); Strings1,s2; inta; Scannerme=newScanner(System.in); s1=me.next(); s2=me.next(); a=me.nextInt(); giftg1=newgift(s1,s2,a); giftgroup.add(g1); } staticvoidexchange(){ Strings1,s2,c="无此礼品"; inta,b=0; giftmanger.show(); Scannerme=newScanner(System.in); System.out.println("请输入您的会员编号: "); s1=me.next(); System.out.println("请输入您要兑换的礼品编号: "); s2=me.next(); System.out.println("请输入您要兑换的礼品数量: "); a=me.nextInt(); booleanb1=true; for(inti=0;i {b=giftgroup.get(i).costjf; c=giftgroup.get(i).caption; b1=false; } if(b1==true)System.out.println("查无此礼品! "); elsevipmanger.exchange(s1,a,b); System.out.println("兑换结果: "); System.out.println("礼品名称"+""+"礼品积分"+""+"礼品数量"+""+"消耗积分"); System.out.println(c+""+b+""+a+""+(a*b)); } publicstaticbooleanstart(){ menum=newmenu(); m.gift(); intx; Scannerme=newScanner(System.in); x=me.nextInt(); switch(x){ case1: show();break; case2: delete();break; case3: addd();break; case4: exchange();break; case5: returnfalse; } returntrue; } } publicclassshoping{ staticvoidshop(){ bookmanger.show(); Strings1,s2,s3; inta,b=0; Scannerme=newScanner(System.in); System.out.println("请输入您的会员编号: "); s1=me.next(); System.out.println("请输入书籍编号: "); s2=me.next(); System.out.println("请输入购买数量: "); a=me.nextInt(); b=bookmanger.price(s2); s3=bookmanger.name(s2); System.out.println("书名"+""+"单价"+""+"数量"+""+"总价"); System.out.println(s3+""+b+""+a+""+(a*b)); vipmanger.shop(s1,a,b); } publicstaticbooleanstart(){ menum=newmenu(); m.shopping(); intx; Scannerme=newScanner(System.in); x=me.nextInt(); switch(x){ case1: shop();break; case2: returnfalse; } returntrue; } } publicclassmenu{ voidmainmenu(){ System.out.println("书店管理系统"); 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("5、注销"); System.out.println("****************************"); } publicvoidvip(){ 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("5、查询会员"); System.out.println("6、返回上层菜单"); System.out.println("****************************"); } publicvoidbookmanger(){ System.out.println("书店管理系统>书籍管理: "); System.out.println("****************************"); System.out.println("1、书籍信息查询"); System.out.println("2、删除书籍"); System.out.println("3、添加书籍"); System.out.println("4、返
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 书店 管理 系统 源代码
![提示](https://static.bdocx.com/images/bang_tan.gif)