java购物系统源代码.docx

上传人:b****8 文档编号:10402724 上传时间:2023-02-11 格式:DOCX 页数:29 大小:22.65KB
下载 相关 举报
java购物系统源代码.docx_第1页
第1页 / 共29页
java购物系统源代码.docx_第2页
第2页 / 共29页
java购物系统源代码.docx_第3页
第3页 / 共29页
java购物系统源代码.docx_第4页
第4页 / 共29页
java购物系统源代码.docx_第5页
第5页 / 共29页
点击查看更多>>
下载资源
资源描述

java购物系统源代码.docx

《java购物系统源代码.docx》由会员分享,可在线阅读,更多相关《java购物系统源代码.docx(29页珍藏版)》请在冰豆网上搜索。

java购物系统源代码.docx

java购物系统源代码

1StartSMS.java

packagecn.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(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;

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.java

packagecn.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;

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[3]=420.77999999999997D;

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;

importjava.util.Scanner;

/**

*礼物管理类

*

*@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=

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 成人教育 > 专升本

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1