实战
package Struct;
import java.util.Scanner;
public class IfDemo04 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("输入消费金额:");
double dollar = scanner.nextDouble();
if (dollar>=200){
System.out.println("请输入是否为会员");
Scanner scan = new Scanner(System.in);
String str = scan.next();
if (str.equals("是")){
double sale = 0.95 * dollar;
String Y = "会员价为:"+ sale;
System.out.println(Y);
}else if(str.equals("不是")){
System.out.println("非会员价为:"+dollar);
}
scan.close();
}else if (dollar<200){
System.out.println("未满200价为:"+dollar);
}
scanner.close();
}
}