IF语句-商品打折案例
package cn.tedu.Ifdemo;
import java.util.Scanner;
//测试商品打折案例
public class day03001_IF {
public static void main(String[] args) {
//1.接收用户输入原价
double price = new Scanner(System.in).nextDouble();
//2.计算折后价
double count = price;//用来保存折后价
if(price>=5000) {
count = price0.5;//满5000打五折
}
else if(price>=2000) {
count = price0.8;//满2000打八折
}
else if(price>=1000) {
count = price0.9;//满1000打九折
}
/ else {
count =price;
}
*/
System.out.println("原价是:"+price+"折后价是:"+count);
}
}
BY Healer_小振