java書店管理系統(tǒng)源代碼_第1頁
java書店管理系統(tǒng)源代碼_第2頁
java書店管理系統(tǒng)源代碼_第3頁
java書店管理系統(tǒng)源代碼_第4頁
java書店管理系統(tǒng)源代碼_第5頁
已閱讀5頁,還剩6頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

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(" 書店管理銷售系統(tǒng)"); System.out.println("*"); System.out.println(" 1、登錄系統(tǒng)"); System.out.println(" 2、退出

2、系統(tǒng)"); System.out.println("*"); System.out.println("請選擇:"); int m; Scanner s=new Scanner(System.in); m=s.nextInt(); if(m=1) for(int i=0;i<3;i+) System.out.println("請輸入賬戶名和密碼"); String s3,s4; Scanner ss=new Scanner(System.in); s3=s.next(); s4=s.next(); if(user.equ

3、als(s3)&&password.equals(s4) b1=true ; else b1=false; if(i=0&&b1=false)System.out.println("用戶名或密碼輸入錯(cuò)誤一次,還有兩次機(jī)會(huì)!"); if(i=1&&b1=false)System.out.println("用戶名或密碼輸入錯(cuò)誤兩次,還有一次機(jī)會(huì)!"); if(i=2&&b1=false)System.out.println("三次輸入錯(cuò)誤,退出系統(tǒng)!");System.exi

4、t(0); if(b1=true) System.out.println("登錄成功!"); break; if(m=2)System.exit(0); package manger;import java.util.ArrayList;import java.util.Scanner;import manger.vip;import System.menu;public class vipmanger static ArrayList<vip> vipgroup=new ArrayList<vip>();public vipmanger() vip

5、group.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 add

6、d() System.out.println("請一次輸入編號(hào),姓名,積分"); 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("請輸入要求刪除的會(huì)員編號(hào):"); String s; Scanner me=new Scanner (System.

7、in); s=me.next(); boolean b1=true; for(int i=0;i<vipgroup.size();i+) if(s.equals(vipgroup.get(i).ID) vipgroup.remove(i); b1=false; if(b1)System.out.println("查無此會(huì)員!"); static void correct() System.out.println("請輸入要修改信息的會(huì)員編號(hào):"); String sss; Scanner s=new Scanner(System.in); sss=

8、s.next(); boolean b1=true; for(int i=0;i<vipgroup.size();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(); v

9、ipgroup.get(i).score=b; if(b1=true)System.out.println("查無此會(huì)員!"); static void select() System.out.println("請輸入要查詢的會(huì)員編號(hào):"); String s; Scanner me=new Scanner(System.in); s=me.next(); boolean b1=true ; for(int i=0;i<vipgroup.size();i+) if (s.equals(vipgroup.get(i).ID)System.out.pr

10、intln(vipgroup.get(i).ID+" "+vipgroup.get(i).name+" "+vipgroup.get(i).score); b1=false ; if(b1=true)System.out.println("查無此會(huì)員!"); static void show() for(int i=0;i<vipgroup.size();i+) System.out.println(vipgroup.get(i).ID+" "+vipgroup.get(i).name+" &quo

11、t;+vipgroup.get(i).score); public static void exchange(String s1,int a,int b) boolean b1=true; for(int i=0;i<vipgroup.size();i+) if(s1.equals(vipgroup.get(i).ID) if(vipgroup.get(i).score<(a*b)System.out.println("積分不足,不能兌換!"); else vipgroup.get(i).score-=a*b; b1=false; if(b1=true)Syst

12、em.out.println("查無此會(huì)員,不能兌換!"); public static void shop(String s1,int a,int b) boolean b1=true; for( int i=0;i<vipgroup.size();i+)if(s1.equals(vipgroup.get(i).ID)vipgroup.get(i).score+=a*b; b1=false; if(b1=true)System.out.println("查無此會(huì)員,不能購買!"); public static boolean start() me

13、nu 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; case 6:return false; return true; public class book public String number; public String name

14、; 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 bookmanger static ArrayList<book> bookgroup=new ArrayList<book>(); public bookman

15、ger() bookgroup.add(new book("001","c語言",20,20); bookgroup.add(new book("002","大學(xué)英語",22,22); bookgroup.add(new book("003","高等數(shù)學(xué)",28,28); static void show() for(int i=0;i<bookgroup.size();i+) System.out.println(bookgroup.get(i).number+&qu

16、ot; "+bookgroup.get(i).name+" "+bookgroup.get(i).price+" "+bookgroup.get(i).jf); static void addd() System.out.println("請依次輸入書籍的編號(hào),名稱,價(jià)格,積分:"); 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=

17、new book(S1,S2,A,B); bookgroup.add(b1); static void delete() System.out.println("請輸入要?jiǎng)h除的書籍編號(hào):"); String s11; Scanner me=new Scanner(System.in); s11=me.next(); boolean b1=true; for(int i=0;i<bookgroup.size();i+) if(s11.equals(bookgroup.get(i).number) bookgroup.remove(i); b1=false; if(b1)

18、System.out.println("查無此書!"); public static int price(String s1 ) int a=0; int i; for( i=0;i<bookgroup.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;i<bookgroup.size();i+)i

19、f(s1.equals(bookgroup.get(i).number)a=bookgroup.get(i).name; return a; public static boolean start() menu 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 tr

20、ue; public class gift public String number; public String caption ; public int costjf; gift(String s1,String 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;p

21、ublic class giftmanger static ArrayList<gift> giftgroup=new ArrayList<gift>();public giftmanger()giftgroup.add(new gift("001","鼠標(biāo)墊",100);giftgroup.add(new gift("002","書夾子",50);giftgroup.add(new gift("003","中性筆",30); static void

22、show() for(int i=0;i<giftgroup.size();i+) System.out.println(giftgroup.get(i).number+" "+giftgroup.get(i).caption+" "+giftgroup.get(i).costjf); static void delete() System.out.println("請輸入要?jiǎng)h除的禮品編號(hào):"); String s; Scanner ss=new Scanner(System.in); s=ss.next();boolean b

23、1=true; for(int i=0;i<giftgroup.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("請輸入要添加的禮品編號(hào),名稱,所需積分:"); String s1,s2; int a; Scanner me=new Scanner(System.in); s1=me.next(

24、); 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("請輸入您的會(huì)員編號(hào):"); s1=me.next(); System.out.println("請輸入您要兌換的禮品編號(hào):"

25、;); s2=me.next(); System.out.println("請輸入您要兌換的禮品數(shù)量:"); a=me.nextInt(); boolean b1=true; for(int i=0;i<giftgroup.size();i+)if(s2.equals(giftgroup.get(i).number) b=giftgroup.get(i).costjf; c=giftgroup.get(i).caption; b1=false; if(b1=true)System.out.println("查無此禮品!"); else vipman

26、ger.exchange(s1, a, b); System.out.println("兌換結(jié)果:"); System.out.println("禮品名稱"+" "+"禮品積分"+" "+"禮品數(shù)量"+" "+"消耗積分"); System.out.println(c+" "+b+" "+a+" "+(a*b); public static boolean start() me

27、nu m=new menu(); m.gift(); 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:exchange();break; case 5:return false; return true; public class shoping static void shop() bookmanger.show();String s1,s2,s3; int a

28、,b=0; Scanner me=new Scanner(System.in); System.out.println("請輸入您的會(huì)員編號(hào):"); s1=me.next(); System.out.println("請輸入書籍編號(hào):"); s2=me.next(); System.out.println("請輸入購買數(shù)量:"); a=me.nextInt(); b=bookmanger.price(s2); s3=(s2); System.out.println("書名"+"

29、; "+"單價(jià)"+" "+"數(shù)量"+" "+"總價(jià)"); System.out.println(s3+" "+b+" "+a+" "+(a*b); vipmanger.shop(s1, a, b); public static boolean start() menu m=new menu(); m.shopping(); int x; Scanner me= new Scanner(System.in); x=me.next

30、Int(); switch(x) case 1:shop();break; case 2:return false; return true; public class menu void mainmenu() System.out.println(" 書店管理系統(tǒng)"); System.out.println("*"); System.out.println("書店管理系統(tǒng)"); System.out.println(" 1、會(huì)員管理"); System.out.println(" 2、書籍管理"

31、;); System.out.println(" 3、購物結(jié)算"); System.out.println(" 4、積分兌換禮品"); System.out.println(" 5、注銷"); System.out.println("*"); public void vip() System.out.println("書店管理系統(tǒng)>會(huì)員管理:"); System.out.println("*"); System.out.println("1、顯示會(huì)員信息&qu

32、ot;); System.out.println("2、刪除會(huì)員"); System.out.println("3、添加會(huì)員"); System.out.println("4、修改會(huì)員信息"); System.out.println("5、查詢會(huì)員"); System.out.println("6、返回上層菜單"); System.out.println("*"); public void bookmanger() System.out.println("書店管理系統(tǒng)>書籍管理:"); System.out.println("*"); System.out.println("1、書籍信息查詢"); System.out.println("2、刪除書籍"); System.out.println("3、添加書籍"); System.out.println("4、返回上層菜單"); S

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論