#include <stdio.h>
int main(int argc,char* argv[])
{
int nBase = 1500,nPerformance = 0,nTemp = 0,nRes = 0;
int nDuty = 0,nInvigilate = 0,nClass = 0;
double fReserve = 0.0;
printf("輸入老師值班天數(不少於5天,不能超過22天):");
nRes = scanf("%d",&nDuty);
while(nRes == 1)
{
if (nDuty >= 5 && nDuty <= 22)
{
break;
}
else if (nDuty < 0)
{
printf("輸入數據有誤,請輸入整數!\n");
}
else
{
printf("輸入范圍有誤,請輸入整數!\n");
}
printf("輸入老師值班天數(不少於5天,不能超過22天):");
nRes = scanf("%d",&nDuty);
}
printf("輸入老師監考次數(不能超過10次):");
nRes = scanf("%d",&nInvigilate);
while(nRes == 1)
{
if (nInvigilate >= 0 && nInvigilate <= 10)
{
break;
}
else if (nInvigilate < 0)
{
printf("輸入數據有誤,請輸入整數!\n");
}
else
{
printf("輸入范圍有誤,請輸入整數!\n");
}
printf("輸入老師監考次數(不能超過10次):");
nRes = scanf("%d",&nInvigilate);
}
printf("輸入老師上課次數(不能超過30次):");
nRes = scanf("%d",&nClass);
while(nRes == 1)
{
if (nClass >= 0 && nClass <= 30)
{
break;
}
else if (nClass < 0)
{
printf("輸入數據有誤,請輸入整數!\n");
}
else
{
printf("輸入范圍有誤,請輸入整數!\n");
}
printf("輸入老師上課次數(不能超過30次):");
nRes = scanf("%d",&nClass);
}
nPerformance = (nDuty * 60) + (nInvigilate * 30) + (nClass * 64);
nTemp = nPerformance + nBase;
if (nTemp > 5000)
{
fReserve = (nTemp - 5000) * 0.25 + 1000 * 0.2 + 2000 * 0.15 + 2000 * 0.1;
}
else if (nTemp > 4000 && nTemp < 5000)
{
fReserve = (nTemp - 4000) * 0.2 + 2000 * 0.15 + 2000 * 0.1;
}
else if (nTemp > 2000 && nTemp < 4000)
{
fReserve = (nTemp - 2000) * 0.15 + 2000 * 0.1;
}
else if (nTemp < 2000)
{
fReserve = (float)(nTemp * 0.1);
}
printf("績效工資總額是%d\n",nPerformance);
printf("工資總額是%d\n",nTemp);
printf("需要繳納的公積金是%0.2f\n",fReserve);
return 0;
}
因為要進行白盒測試,求大神進行修改,謝謝诶