Created
March 30, 2013 10:13
-
-
Save zhuhai/5276208 to your computer and use it in GitHub Desktop.
超市根据会员卡的不同实行不同的打折
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Card{ | |
| public static void main(String[] args){ | |
| java.util.Scanner input=new java.util.Scanner(System.in); | |
| System.out.println("请输入卡的类型:金|银|铜"); | |
| String type=input.next(); | |
| System.out.println("请输入消费金额:"); | |
| double money=input.nextDouble(); | |
| if(type.equals("金")){ | |
| money=money*0.7; | |
| }else if(type.equals("银")){ | |
| money=money*0.8; | |
| }else if(type.equals("铜")){ | |
| money=money*0.9; | |
| }else{ | |
| System.out.println("您不是会员,不能享受打折!"); | |
| } | |
| System.out.println("您需支付:"+money+"元。欢迎下次光临!"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment