Skip to content

Instantly share code, notes, and snippets.

@zhuhai
Created March 30, 2013 10:13
Show Gist options
  • Select an option

  • Save zhuhai/5276208 to your computer and use it in GitHub Desktop.

Select an option

Save zhuhai/5276208 to your computer and use it in GitHub Desktop.
超市根据会员卡的不同实行不同的打折
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