标签:java-第四章-升级我行我素购物管理系统 实现换购功能
import java.util.Scanner; public class A05 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.println("请输入消费金额:"); int money = input.nextInt(); if (money >= 50) { System.out.println("是否参加优惠换购活动:"); System.out.println("1.满50元,加2元换购百事可乐饮料1瓶"); System.out.println("2.满100,加3元换购500ml可乐一瓶"); System.out.println("2.满100,加10元换购5公斤面粉"); System.out.println("4.满200元,加10元换购苏泊尔炒锅一个"); System.out.println("5.满200元,加20元可换购欧莱雅爽肤水1瓶"); System.out.println("0.不换购"); System.out.print("请选择:"); int choice = input.nextInt(); String show = null; switch (choice) { case 1: show = "百事可乐饮料1瓶"; money = money + 2; break; case 2: show = "500ml可乐一瓶"; money = money + 3; break; case 3: show = "5公斤面粉"; money = money + 10; break; case 4: money = money + 10; show = "苏泊尔炒锅一个"; break; case 5: money = money + 20; show = "欧莱雅爽肤水1瓶"; break; case 0: System.out.println("本次消费金额"+money); System.exit(0); break; default: System.out.println("输入有误!程序异常结束!"); break; } System.out.println("本次消费金额:"+money+"元"); System.out.println("成功换购,"+show); } else { System.out.println("您的消费你符合活动条件!"); } } }
java-第四章-升级我行我素购物管理系统,实现换购功能,布布扣,bubuko.com
标签:java-第四章-升级我行我素购物管理系统 实现换购功能
原文地址:http://1797077217.blog.51cto.com/8956560/1420172