1057 Exercise 4-10-2 Bonus Calculation _xynuoj (C)

Source: Internet
Author: User
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;  


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.