Java编程语言基础 第三章 我行我素换购
package cn.save;
import java.util.Scanner;
public class Myshop {
public static void main(String[] args) {
System.out.println("\t" + "欢迎使用我行我素购物管理系统");
Scanner input = new Scanner(System.in);
System.out.println("\t\t" + "1.登录系统" + "\n" + "\t\t" + "2.退出");
System.out.println("*******************************************");
int num = input.nextInt();
switch (num) {
case 1:
System.out.println("\t" + "1.客户信息管理");
System.out.println("\t" + "2.购物结算");
System.out.println("\t" + "3.真情回馈");
System.out.println("\t" + "4.注销");
int num1 = input.nextInt();
switch (num1) {
case 1:
System.out.println("购物系统>客户信息管理");
System.out.println("\t" + "1.显示所有客户信息");
System.out.println("\t" + "2.添加客户信息");
System.out.println("\t" + "3.修改客户信息");
System.out.println("\t" + "4.查询客户信息");
break;
case 3:
System.out.println("购物管理系统>真情回馈");
System.out.println("\t" + "1.幸运大放送");
System.out.println("\t" + "2.幸运抽奖");
System.out.println("\t" + "3.生日问候");
// System.out.println("\t"+"4.换购优惠");
System.out.print("请输入消费金额:");
double je = input.nextDouble();
System.out.print("是否参加优惠换购活:");
String num2 = input.next();
System.out.println(num2);
if (num2.equals("是")) {
if (je >= 200) {
System.out
.print("换购 百事 1 500ml可乐 2 5kg面粉 3 苏泊尔菜锅 4 欧莱雅爽肤水 5 ");
int num3 = input.nextInt();
switch (num3) {
case 1:
System.out.println("本次消费总金额:" + (je+2));
System.out.println("成功换购百事可乐饮料1瓶");
break;
case 2:
System.out.println("本次消费总金额:" + (je+3));
System.out.println("成功换购500ml可乐1瓶");
break;
case 3:
System.out.println("本次消费总金额:" + (je+10));
System.out.println("成功换购5kg面粉");
break;
case 4:
System.out.println("本次消费总金额:" + (je+10));
System.out.println("成功换购苏泊尔菜锅一个");
break;
case 5:
System.out.println("本次消费总金额:" + (je+20));
System.out.println("成功换购欧莱雅爽肤水一瓶");
break;
}
} else if (200 > je & je >= 100) {
System.out
.print("换购 百事 1 500ml可乐 2 5kg面粉 3 苏泊尔菜锅 4 欧莱雅爽肤水 5 ");
int num4 = input.nextInt();
switch (num4) {
case 1:
System.out.println("本次消费总金额:" + (je+2));
System.out.println("成功换购百事可乐饮料1瓶");
break;
case 2:
System.out.println("本次消费总金额:" + (je+3));
System.out.println("成功换购500ml可乐1瓶");
break;
case 3:
System.out.println("本次消费总金额:" + (je+10));
System.out.println("成功换购5kg面粉");
break;
}
} else if (100 > je & je >= 50) {
System.out.println("本次消费总金额:" + (je+2));
System.out.println("成功换购百事可乐饮料1瓶");
}
else {
System.out.println("本次消费总金额:" + (je+0));
System.out.println("欢迎下次光临");
}
}
}
break;
case 2:
System.out.println("欢迎下次光临");
break;
default:
System.out.println("输入错误");
}
}
}