java购物系统源代码.docx
- 文档编号:7200293
- 上传时间:2023-01-21
- 格式:DOCX
- 页数:25
- 大小:22.60KB
java购物系统源代码.docx
《java购物系统源代码.docx》由会员分享,可在线阅读,更多相关《java购物系统源代码.docx(25页珍藏版)》请在冰豆网上搜索。
java购物系统源代码
1StartSMS.java
packagecn.itcast;
import
/**
*系统开启类
*
*@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(j<1)
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.java
packagecn.itcast;
import
/**
*验证管理员登录
*
*@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.java
packagecn.itcast;
import
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;
do
if(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;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.java
packagecn.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;
goodsName[1]="Kappa网球裙";
goodsPrice[1]=200D;
goodsName[2]="网球拍";
goodsPrice[2]=780D;
goodsName[3]="addidasT恤";
goodsPrice
goodsName[4]="Nike运动鞋";
goodsPrice[4]=900D;
goodsName[5]="Kappa网球";
goodsPrice[5]=45D;
goodsName[6]="KappaT恤";
goodsPrice[6]=245D;
custNo[0]=1900;
custBirth[0]="08/05";
custScore[0]=2000;
custNo[1]=1711;
custBirth[1]="07/13";
custScore[1]=4000;
custNo[2]=1623;
custBirth[2]="06/26";
custScore[2]=5000;
custNo[3]=1545;
custBirth[3]="04/08";
custScore[3]=2200;
custNo[4]=1464;
custBirth[4]="08/16";
custScore[4]=1000;
custNo[5]=1372;
custBirth[5]="12/23";
custScore[5]=3000;
custNo[6]=1286;
custBirth[6]="12/21";
custScore[6]=10080;
}
publicStringgoodsName[];
publicdoublegoodsPrice[];
publicintcustNo[];
publicStringcustBirth[];
publicintcustScore[];
publicManagermanager;
}
5Gift.java
packagecn.itcast;
/**
*礼物类
*/
publicclassGift{
publicGift(){
}
publicStringtoString(){
return(newStringBuilder()).append("一个价值¥").append(price).append("的")
.append(name).toString();
}
publicStringname;
publicdoubleprice;
}
6GiftManagement.java
packagecn.itcast;
import
/**
*礼物管理类
*
*@authorAdministrator
*
*/
publicclassGiftManagement{
publicGiftManagement(){
}
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;
do
if(scanner.next().equals("n")){
Menumenu=newMenu();
menu.setData(goodsName,goodsPrice,custNo,custBirth,
custScore);
menu.showSendGMenu();
}else{
System.out.print("输入错误,请重新'n'返回上一级菜单:
");
flag=false;
}
while(!
flag);
}
publicvoidsendBirthCust(){
System.out.println("购物管理系统>生日问候\n\n");
System.out.print("请输入今天的日期(月/日<用两位表示>):
");
Scannerscanner=newScanner(System.in);
Strings=scanner.next();
System.out.println(s);
Strings1="";
booleanflag=false;
for(inti=0;i if(custBirth[i]! =null&&custBirth[i].equals(s)){ s1=(newStringBuilder()).append(s1).append(custNo[i]).append( "\n").toString(); flag=true; } if(flag){ System.out.println("过生日的会员是: "); System.out.println(s1); System.out.println("恭喜! 获赠MP3一个! "); }else{ System.out.println("今天没有过生日的会员! "); } returnLastMenu(); } publicvoidsendLuckyCust(){ System.out.println("购物管理系统>幸运抽奖\n\n"); System.out.print("是否开始(y/n): "); Scannerscanner=newScanner(System.in); if(scanner.next().equals("y")){ inti=(int)(Math.random()*10D); booleanflag=false; Strings=""; for(intk=0;k =0;k++){ intj=(custNo[k]/100)%10; if(j==i){ s=(newStringBuilder()).append(s).append(custNo[k]) .append("\t").toString(); flag=true;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 购物 系统 源代码
![提示](https://static.bdocx.com/images/bang_tan.gif)