Topic description
Bonuses awarded by an enterprise are based on the profit percentage. If the profit is less than or equal to 100000, the bonus may be 10%, the profit is higher than 100000 yuan, less than 200000 yuan (100000<i<=200000), the portion below 100000 yuan is still under 10% Commission, Above 100000 yuan Partial commission proportion is 7.5%;200000<i<=400000, below 200000 yuan's partial still according to above Method Commission (the same below), above 200000 yuan's portion presses 5% Commission; 400000<i<= 600000 yuan, more than 400000 yuan in the proportion of 3% Commission, 600000<i<=1000000, more than 600000 yuan in the part of the 1.5% Commission, i>1000000 Yuan, more than 1000000 yuan in the part of the 1% Commission.
From the keyboard output month profit I, the number should be issued bonus, the bonus accurate to the point.
Required to be implemented with a switch statement. Input
Enterprise month profit, decimal, double type output should be a bonus, accurate to the decimal point after 2 digits, the end of line wrapping. Sample input
1050
Sample output
105.00
#include <stdio.h>
int main ()
{
double l,f;
int C;
scanf ("%lf", &l);
c=l/1000000;
Switch (c)
{case
0:f=l*0.1;break;
Case 1:f=100000*0.1+ (l-100000) *0.075;break;
Case 2: Case
3:f=100000*0.1+100000*0.075+ (l-200000) *0.05;break;
Case 4: Case
5:f=100000*0.1+100000*0.075+200000*0.05+ (l-400000) *0.03;break;
Case 6: Case
7: Case
8: Case
9:f=100000*0.1+100000*0.075+200000*0.05+200000*0.03+ (l-600000) *0.015; break;
Case 10:f=100000*0.1+100000*0.075+200000*0.05+200000*0.03+4000000*0.015+ (l-10000000) *0.01;break;
}
if (c>11)
{
f=100000*0.1+100000*0.075+200000*0.05+200000*0.03+4000000*0.015+ (l-10000000) *0.01;
}
printf ("%.2f\n", f);
return 0;