void setup(){
size(200,100);
background(255);
fill(0);
text("tax = "+function(500000),50,50);
println(function(500000));
}
int function (int x){
int income = 0;
if (x >= 800000){ //income is greater than or equal to 800000
income = x*25/100;
}else if((x < 800000)&&( x >= 500000)){ //income is less than 800000 and greater than or equal to 500000
income = x*20/100;
}else if((x < 500000)&&(x >= 300000)){ //income is less than 500000 and greater than or equal to 300000
income = x*15/100;
}else if((x < 300000)&&(x >= 150000)){ //income is less than 300000 and greater than or equal to 150000
income = x*10/100;
}else{ //income is less than 150000
income = 0;
}
return income;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น