java购物系统源代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1StartSMS.javapackagecn.itcast;importjava.util.Scanner;/***系统开启类**@authorAdministrator**/publicclassStartSMS{publicStartSMS(){}publicstaticvoidmain(Stringargs[]){Datadata=newData();data.ini();Menumenu=newMenu();menu.setData(data.goodsName,data.goodsPrice,data.custNo,data.custBirth,data.custScore);menu.showLoginMenu();booleanflag=true;label0:do{if(!flag)break;Scannerscanner=newScanner(System.in);inti=scanner.nextInt();VerifyEqualverifyequal=newVerifyEqual();switch(i){case1://'\001'intj=3;do{if(j1)continuelabel0;if(verifyequal.verify(data.manager.username,data.manager.password)){menu.showMainMenu();continuelabel0;}if(j!=1){System.out.println(\n用户名和密码不匹配,请重新输入:);}else{System.out.println(\n您没有权限进入系统!谢谢!);flag=false;}j--;}while(true);case2://'\002'if(verifyequal.verify(data.manager.username,data.manager.password)){System.out.print(请输入新的用户名:);data.manager.username=scanner.next();System.out.print(请输入新的密码:);data.manager.password=scanner.next();System.out.println(用户名和密码已更改!);System.out.println(\n请选择,输入数字:);}else{System.out.println(抱歉,你没有权限修改!);flag=false;}break;case3://'\003'System.out.println(谢谢您的使用!);//flag=false;System.exit(0);break;default:System.out.print(\n输入有误!请重新选择,输入数字:);break;}}while(flag);}}2VerifyEqual.javapackagecn.itcast;importjava.util.Scanner;/***验证管理员登录**@authorAdministrator**/publicclassVerifyEqual{publicVerifyEqual(){}publicbooleanverify(Strings,Strings1){System.out.print(请输入用户名:);Scannerscanner=newScanner(System.in);Strings2=scanner.next();System.out.print(请输入密码:);scanner=newScanner(System.in);Strings3=scanner.next();returns2.equals(s)&&s1.equals(s3);}}3CustManagement.javapackagecn.itcast;importjava.util.Scanner;publicclassCustManagement{publicCustManagement(){}publicvoidsetData(Stringas[],doublead[],intai[],Stringas1[],intai1[]){goodsName=as;goodsPrice=ad;custNo=ai;custBirth=as1;custScore=ai1;}publicvoidreturnLastMenu(){System.out.print(\n\n请按'n'返回上一级菜单:);Scannerscanner=newScanner(System.in);booleanflag=true;doif(scanner.next().equals(n)){Menumenu=newMenu();menu.setData(goodsName,goodsPrice,custNo,custBirth,custScore);menu.showCustMMenu();}else{System.out.print(输入错误,请重新'n'返回上一级菜单:);flag=false;}while(!flag);}publicvoidadd(){System.out.println(购物管理系统客户信息管理添加客户信息\n\n);Scannerscanner=newScanner(System.in);System.out.print(请输入会员号(4位整数):);inti=scanner.nextInt();System.out.print(请输入会员生日(月/日用两位数表示):);Strings=scanner.next();System.out.print(请输入积分:);intj=scanner.nextInt();intk=-1;intl=0;do{if(l=custNo.length)break;if(custNo[l]==0){k=l;break;}l++;}while(true);custNo[k]=i;custBirth[k]=s;custScore[k]=j;System.out.println(新会员添加成功!);returnLastMenu();}publicvoidmodify(){System.out.println(购物管理系统客户信息管理修改客户信息\n\n);System.out.print(请输入会员号:);Scannerscanner=newScanner(System.in);inti=scanner.nextInt();System.out.println(会员号生日积分);System.out.println(------------|------------|---------------);intj=-1;intk=0;do{if(k=custNo.length)break;if(custNo[k]==i){System.out.println((newStringBuilder()).append(custNo[k]).append(\t\t).append(custBirth[k]).append(\t\t).append(custScore[k]).toString());j=k;break;}k++;}while(true);if(j!=-1){System.out.println(****************************************\n);System.out.println(\t\t\t\t1.修改会员生日.\n);System.out.println(\t\t\t\t2.修改会员积分.\n);System.out.println(****************************************\n);System.out.print(请选择,输入数字:);switch(scanner.nextInt()){case1://'\001'System.out.print(请输入修改后的生日:);custBirth[j]=scanner.next();System.out.println(生日信息已更改!);break;case2://'\002'System.out.print(请输入修改后的会员积分:);custScore[j]=scanner.nextInt();System.out.println(会员积分已更改!);break;}}else{System.out.println(抱歉,没有你查询的会员。);}returnLastMenu();}publicvoidsearch(){System.out.println(购物管理系统客户信息管理查询客户信息\n);Strings=y;Scannerscanner=newScanner(System.in);for(;s.equals(y);s=scanner.next()){System.out.print(请输入会员号:);inti=scanner.nextInt();System.out.println(会员号生日积分);System.out.println(------------|------------|---------------);booleanflag=false;intj=0;do{if(j=custNo.length)break;if(custNo[j]==i){System.out.println((newStringBuilder()).append(custNo[j]).append(\t\t).append(custBirth[j]).append(\t\t).append(custScore[j]).toString());flag=true;break;}j++;}while(true);if(!flag)System.out.println(抱歉,没有你查询的会员信息。);System.out.print(\n要继续查询吗(y/n):);}returnLastMenu();}publicvoidshow(){System.out.println(购物管理系统客户信息管理显示客户信息\n\n);System.out.println(会员号生日积分);System.out.println(------------|------------|---------------);inti=custNo.length;for(intj=0;ji&&custNo[j]!=0;j++)System.out.println((newStringBuilder()).append(custNo[j]).append(\t\t).append(custBirth[j]).append(\t\t).append(custScore[j]).toString());returnLastMenu();}publicStringgoodsName[];publicdoublegoodsPrice[];publicintcustNo[];publicStringcustBirth[];publicintcustScore[];}4Date.javapackagecn.itcast;/***初始化数据**@authorAdministrator**/publicclassData{publicData(){goodsName=newString[50];goodsPrice=newdouble[50];custNo=newint[100];custBirth=newString[100];custScore=newint[100];manager=newManager();}publicvoidini(){goodsName[0]=addidas运动鞋;goodsPrice[0]=880D;good

1 / 20
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功