Java Classic Programming question 50-way 12

Source: Internet
Author: User

The bonus paid by the enterprise under the Profit (I) is less than or equal to 100,000 yuan, the bonus can be raised 10%, the profit is higher than 100,000 yuan, below the 200,000 yuan, the part of less than 100,000 yuan by 10% commission, higher than 100,000 yuan portion, the Commission 7.5%, 200,000 to 400,000, higher than 200,000 yuan of the portion, A commission of 5%, 400,000 to 600,000, higher than 400,000 yuan, can be a commission of 3%, 600,000 to 1 million, the portion higher than 600,000 yuan, can be a commission of 1.5%, above 1 million yuan, the portion of more than 1 million yuan by 1% Commission. Enter the current month profit I from the keyboard, the total bonus should be issued?

public class Example12 {
public static void Main (string[] args) {
Money (1000);
}


public static void Money (Double x) {
Double y = 0;
if (x > 0 && x <= 10) {
y = x * 0.1;
} else if (x > Ten && x <= 20) {
y = ten * 0.1 + (x-10) * 0.075;
} else if (x > && x <= 40) {
y = ten * 0.1 + x * 0.075 + (x-20) * 0.05;
} else if (x > I && x <= 60) {
y = ten * 0.1 + * 0.075 + * 0.05 + (x-40) * 0.03;
} else if (x > && x <= 100) {
y = * 0.175 + * 0.05 + * 0.03 + (x-60) * 0.015;
} else if (x > 100) {

}
SYSTEM.OUT.PRINTLN ("Profit is:" +x+ "million Yuan.") \ nthe bonus should be extracted as: "+ y +" million. ");
}
}

Java Classic Programming question 50-way 12

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.