package com.forkeon.test;
import java.awt.event.WindowFocusListener;
import java.util.Scanner;
public class save {
public static void main(String[] args) {
/*
* Scanner input=new Scanner(System.in); System.out.println("输入消费金额");
* double money=input.nextDouble(); if(money>=50){
* System.out.println("参加换购活动");
*
* Scanner input1=new Scanner(System.in); System.out.println(
* "满50元 加2 元换购百事可乐一瓶"); System.out.println("满100元加3元换购500ml可乐一瓶");
* System.out.println("满100元加10元换购5 斤面粉");
* System.out.println("满200元加10元换购1个苏泊尔炒菜锅");
* System.out.println("满200元加20元换购欧莱雅爽肤水一瓶"); System.out.println("不换购");
* System.out.println("请选择");
*
* int choice=input1.nextInt(); switch (choice) { case 1: if(money>=50)
* money=money+2; System.out.println("成功换购:百事可乐一瓶"); break; case 2:
* if(money>=100) money=money+3; System.out.println("成功换购:500ml可乐一瓶");
* break; case 3: if(money>=100) money=money+10;
* System.out.println("成功换购:5斤面粉"); break; case 4: if(money>=200)
* money=money+10; System.out.println("成功换购:苏泊尔炒菜锅"); break; case 5:
* if(money>=200) money=money+20; System.out.println("成功换购:欧莱雅爽肤水");
* default: System.out.println("不换购"); break;
*
* }
*
* }else{ System.out.println("不参加"); }
*
* System.out.println(money);
*/
Scanner input = new Scanner(System.in);
System.out.println("输入消费金额");
double money = input.nextDouble();
if (money >= 50) {
System.out.println("1.满50元 加2 元换购百事可乐一瓶");
System.out.println("2.满100元加3元换购500ml可乐一瓶");
System.out.println("3.满100元加10元换购5 斤面粉");
System.out.println("4.满200元加10元换购1个苏泊尔炒菜锅");
System.out.println("5.满200元加20元换购欧莱雅爽肤水一瓶");
System.out.println("0.不换购");
System.out.println("请选择");
int choice = input.nextInt();
int extra=0; // 换购付款
switch (choice) {
case 1:
if (money >= 50)
extra= 2;
break;
case 2:
if (money >= 100)
extra=3;
break;
case 3:
if (money >= 100)
extra=10;
break;
case 4:
if (money >= 200)
extra=10;
break;
case 5:
if (money >= 200)
extra=20;
default:
System.out.println("不换购");
break;
}
double total=money+extra;
System.out.println("消费金额"+total);
if(choice==1){
System.out.println("");
}else if(choice==2){
System.out.println("成功换购:百事可乐一瓶");
}else if(choice==3){
System.out.println("成功换购:500ml可乐一瓶");
}else if(choice==4){
System.out.println("成功换购:5斤面粉");
}else if(choice==5){
System.out.println("成功换购:苏泊尔炒菜锅");
}else if(choice==0){
System.out.println("成功换购:欧莱雅爽肤水");
}
} else {
System.out.println("error..");
}
}
}