需求算出 獎經 並且減去相關的費用算出剩餘金額
class ex2
{
public static void main(String args[])
{
java.util.Scanner sc=new java.util.Scanner(System.in);
int x1=22000;//底薪
int x2=2000;//車馬費
int x3;//業績
int x4;//獎金
int x5;//勞保
int x6;//健保
int x7;//薪資
System.out.println("請輸入業績");
x3=sc.nextInt();
if(x3>=1500000)
{
x4=(int)(x3*0.08);
x5=2500;
x6=2500;
}
else if(x3>=800000 && x3<1500000)
{
x4=(int)(x3*0.05);
x5=2000;
x6=2000;
}
else if(x3>=300000 && x3<800000)
{
x4=(int)(x3*0.03);
x5=1500;
x6=1500;
}
else if(x3>=0 && x3<300000)
{
x4=x3*0;
x5=1000;
x6=1000;
}
else
{
System.out.println("業績需大於0");
x4=0;
x5=0;
x6=0;
}
x7=x1+x2+x4-x5-x6;
System.out.println("\n底薪:"+x1+"元"+
"\n獎金:"+x4+"元"+
"\n勞保:"+x5+"元"+
"\n健保:"+x6+"元"+
"\n薪資:"+x7+"元");
}
}
執行結果:
沒有留言:
張貼留言