在网络技术逐渐渗入社会生活各个层面的今天,传统的购物方式也面临着变革,而网上购物则是一个 很重要的方向。近年来B/S结构应用系统在我国飞速发展起来,越来越多的企业借助网络平台进行商品的销售,各种类型的购物网站为消费者提供了大量的商品, 本系统就是为了适应越来越广泛的网络销售模式而设计开发的,网站可以实现网上购物,通过注册,网上选 购,放人购物车,最后形成订单,商店送货上门交易。
e = input.nextInt(); // 添加货架上的商品价格
if(shopPrice<=0){
System.out.print("您输入的价格不合理,返回菜单!!");
menu();
break;
}
quotID[index] = bianhao;
quotName[index] = shopName;
quotNum[index] = shopNum;
quotInfo[index] = shopInfo;
quotPrice[index] = shopPrice;
System.out.println("商品添加成功,返回主菜单查看!!");
answer="n";
menu();
break;
}while(answer.equals("y"));
}
// 修改菜单
public void rework(){ // 从键盘输入接收一个编号
boolean big=true;
System.out.print("请输入你要修改的商品编号:");
int shopid=input.nextInt();
for(int i=0;i<quotID.length;i++){
if(quotID[i]==0){
break;
}
if(quotID[i]==shopid){
big=false;
System.out.println("1.修改商品名称"+"\n"+"2.修改商品数量"+"\n"+"3.修改商品价格"+"\n"+"4.修改商品信息");
System.out.println("请选择:");
int num1=input.nextInt();
switch(num1){
case 1:
System.out.print("请输入修改后的商品名称:");
quotName[i]=input.next();
System.out.print("修改成功!!");
break;
case 2:
System.out.print("请输入修改后的商品数量:");
quotNum[i]=input.nextInt();
System.out.println("修改成功!!");
break;
case 3:
System.out.print("请输入修改后的商品价格:");
quotPrice[i]=input.nextInt();
System.out.println("修改成功!!");
break;
case 4:
System.out.print("请输入修改后的商品信息:");
quotInfo[i]=input.next();
System.out.println("修改成功!!");
default:
System.out.println("没有你要修改的选项!");
}
}else{
continue;
}
if(big){
System.out.println("您输入的商品编号为无效的编号!");
}
System.out.print("\n按'n'返回主菜单,按'q'退出:");
String fanhui=input.next();
if(fanhui.equals("q")){
System.out.println("退出系统!欢迎下次光临!");
break;
}else if(fanhui.equals("n")){
menu(); // 显示返回菜单
}else {
System.out.println("您是输入有误!返回主菜单!");
menu();
}
}
}
// 删除商品
public void delete() {
boolean big=true;
System.out.print("请输入要删除的商品编号:"); //删除的编号
int delShopid = input.nextInt();
// 循环数组编号里的元素
for (int i = 0; i < quotID.length; i++){ // 循环数组编号里的元素下标
if(quotID[i] == 0){
break;
}
if (quotID[i] == delShopid){ // 判断编号等于数组里的编号的时候执行下面语句
for(int x=i;x<quotID.length-1;x++){
quotID[x]=quotI
D[x+1];
quotName[x] = quotName[x+1];
quotNum[x] = quotNum[x+1];
quotInfo[x] = quotInfo[x+1];
quotPrice[x] = quotPrice[x+1];
continue;
}
b