利用分支语句计算商品折扣

package demo10_22;

import java.util.Scanner;

public class demo04 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入您是否为会员");
		String hy = sc.next();
		System.out.println("请输入您的购物总价");
		double jg = sc.nextDouble();
		if ("是".equals(hy)) {
			System.out.println("尊敬的会员您好");
			if (jg >= 200) {
				System.out.println("您的总价是" + jg * 0.75);
			} else {
				System.out.println("您的总价是" + jg * 0.8);
			}
		} else {
			System.out.println("您的总价是" + jg*0.9);
		}
	}
}

上一篇:基础数学知识


下一篇:Linux笔记(14)Linux中head,tail命令和分页显示(more和less命令)