public class Test1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入:");
int code = sc.nextInt();
fukuan.getNameByNum(code);
}
}
public enum fukuan {
CHARGE_TYPE_CHARGED("自费", 101310001), CHARGE_TYPE_FREE("免费", 101310002),
CHARGE_TYPE_MEMBER_RIGHTS("会员", 101310003);
private int num;
private String name;
public static void getNameByNum(int num){
if(num == CHARGE_TYPE_CHARGED.getNum()){
System.out.println(CHARGE_TYPE_CHARGED.getName());
}else if(num == CHARGE_TYPE_FREE.getNum()){
System.out.println(CHARGE_TYPE_FREE.getName());
}else if (num == CHARGE_TYPE_MEMBER_RIGHTS.getNum()){
System.out.println(CHARGE_TYPE_MEMBER_RIGHTS.getName());
}
}
fukuan(String name, int num) {
this.num = num;
this.name = name;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}