package day04;
//本类用于商品打折
//主要使用了if分支结构
//关于局部变量与成员变量使用区别
import java.util.Scanner;
public class TestDiscout {
public static void main(String[] args) {
int a = 1;
for(a=1;a<=3;a++) {
System.out.println("请输入价格");
double price = new Scanner(System.in).nextDouble();
double discout =discout(price);
System.out.println("折后价为"+discout);
}
}
public static double discout(double b) {
double discout =0;
if(b>5000) {
discout = b*0.5;
}else if(b>4000) {
discout = b*0.5;
}else if(b>3000){
discout = b*0.6;
}else if(b>2000) {
discout = b*0.7;
}else if(b>2000) {
discout = b*0.8;
}else if(b<2000) {
discout = b;}
return discout;
}