/* 本程序应题目要求建立。
计算要求:
基本工资 = 10。00美元/小时
加班(超过40小时)= 1.5倍的时间
税率 : 前 300 美元为 15%
续 150 美元为 20%
余下为 25%
*/
#define _CRT_SECURE_NO_WARNINGS // 别诧异。我用的是VS2017社区版。貌似VS对于C标准不是很友好。
#include<stdio.h>
#define MONEY1 300.0
#define MONEY2 150.0
#define SHUI1 0.15
#define SHUI2 0.2
#define SHUI3 0.25
#define TIME1 40.0
#define SM /* 基本工资 -- START MONEY */ 10.0
int main(void)
{
double time=0;//储存上班时间时间。
double money=0;//储存资金总额。
double shui=0;//储存税金。
printf("Please input your work time( a weak ):\n");
scanf("%lf.\n",&time);
if( time <= TIME1)
{
//该情况为 :一周工作时间 没有超过 一周基本工作时间时;
money = time * SM;
printf("\nInput is loading. Please whaiting some time.\n\n");
if( money <= MONEY1 ) //计算税收。
{
shui = money * SHUI1 ; //当钱没有超过 300 美元时;
}
else if( money <= MONEY1 + MONEY2)
{
shui = ( MONEY1 * SHUI1 ) + ( money - MONEY1) * SHUI2 ; //当钱没有超过 450 美元时;
}
else
{
shui = ( MONEY1 * SHUI1 ) + ( MONEY2 * SHUI2 ) + ( money - MONEY1 - MONEY2 ) * SHUI3 ; // 当钱超过 450 美元时;
}
printf("Total wages is %lf.(工资总额)\n", money);
printf("Tax is %lf.(税金)\n", shui);
printf("Net income is %lf.(净收入)\n", money - shui);
printf("Don't worry about it, my dear. You can be well then now.\n");
}
else
{
//该情况为 :超过 一周基本工作时间 (40 小时 )。
money = ( TIME1 * SM ) + ( time - TIME1 ) * 1.5 * SM;
if( money <= MONEY1 ) //计算税收。
{
shui = money * SHUI1 ; //当钱没有超过 300 美元时;
}
else if( money <= MONEY1 + MONEY2)
{
shui = ( MONEY1 * SHUI1 ) + ( money - MONEY1) * SHUI2 ; //当钱没有超过 450 美元时;
}
else
{
shui = ( MONEY1 * SHUI1 ) + ( MONEY2 * SHUI2 ) + ( money - MONEY1 - MONEY2 ) * SHUI3 ; // 当钱超过 450 美元时;
printf("Total wages is %lf.(工资总额)\n", money);
printf("Tax is %lf.(税金)\n", shui);
printf("Net income is %lf.(净收入)\n", money - shui);
printf("Don't worry about it, my dear. You can be well then now.\n");
}
}
printf("Good luck ! Bye !\n");
getchar();
getchar();
return 0;
}