在网络技术逐渐渗入社会生活各个层面的今天,传统的购物方式也面临着变革,而网上购物则是一个 很重要的方向。近年来B/S结构应用系统在我国飞速发展起来,越来越多的企业借助网络平台进行商品的销售,各种类型的购物网站为消费者提供了大量的商品, 本系统就是为了适应越来越广泛的网络销售模式而设计开发的,网站可以实现网上购物,通过注册,网上选 购,放人购物车,最后形成订单,商店送货上门交易。
输入有误!返回主菜单!");
menu(); // 显示返回菜单
}
lookUp(); //按名称查询商品
}
//查询单个商品菜单
public void lookUp(){
System.out.println("是否按照商品编号查询显示商品?(y/n)");
answer =input.next();
if(answer.equals("y")){
System.out.print("请输入商品编号");
int shopid = input.nextInt();
for (int i = 0; i < quotID.length; i++){
if( quotID[i]==shopid ){
System.out.println("商品编号\t\t"+"商品名称\t\t"+"商品数量"+"\t\t产品信息"+"\t\t产品价格");
System.out.println(quotID[i] + "\t\t" + quotName[i]+ "\t\t" + quotNum[i]+"\t\t"+quotInfo[i]+"\t\t"+quotPrice[i]);
break;
}
if(quotID[i]==0){
System.out.print("抱歉!没有您要选购的商品!");
break;
}
}
System.out.print("\n按'n'返回主菜单:");
answer=input.next();
if(answer.equals("n")){
menu(); // 显示返回菜单
}else {
System.out.println("您的输入有误!返回主菜单!");
menu();
}
}else if(answer.equals("n")){
menu(); // 显示返回菜单
}else {
System.out.println("您的输入有误!返回主菜单!");
menu(); // 显示返回菜单
}
}
// 返回主菜单的方法
public void returnMenu(){
menu();
}
// 添加商品菜单
boolean big=true;
public void addShop() { // 添加货架上的商品编号进行判断,判断货架上是否有该商品编号
System.out.print("请输入商品编号:"); //添加的编号
int bianhao = input.nextInt();
int index = -1;
for (int q = 0; q < quotID.length; q++) { // 循环数组编号里的元素
if(bianhao==quotID[q]){ // 如果输入的是编号重复执行下面操作
System.out.println("输入的编号重复,返回主菜单查看后再添加!!");
menu(); // 显示返回主菜单功能
return;
}
if (quotID[q] == 0) { // 如果输入的编号循环去和货架上的编号数组进行判断,如果相等就执行下面语句
index=q;
break;
}
}
do{
System.out.print("请输入商品名称:");
String shopName = input.next(); // 添加货架上的商品名称
for(int i=0;i<quotID.length;i++){ //循环判断添加的名称
if(shopName.equals(quotName[i])){
System.out.println("输入的名称重复,返回主菜单查看后再添加!!");
menu(); // 显示返回主菜单功能
return;
}
}
System.out.print("请输入商品数量:");
int shopNum = input.nextInt(); // 添加货架上的商品数量
if(shopNum<=0){
System.out.println("您输入的数量不合理,返回主菜单!!!");
menu();
return;//
}
System.out.print("请输入商品信息:");
String shopInfo = input.next(); // 添加货架上的商品信息
System.out.print("请输入商品价格:");
int shopPric