CCF 201612-2 Payroll calculation Java Problem solving

Source: Internet
Author: User
Tags ming

  Problem description   

Xiao Ming's company every month to pay Xiao Ming, and Xiao Ming received wages for the payment of personal income tax after the wages. Assuming that his one-month pre-tax salary (after deducting five of the risk of a gold, not withholding tax before the wages) is S-yuan, then he should pay the personal income tax according to the following formula calculation:

1) Personal income tax threshold of 3500 yuan, if S not more than 3500, then do not pay taxes, more than 3500 yuan of the portion of the calculation of personal income tax, so a=s-3500 yuan;

2) The portion of a not exceeding 1500 yuan, tax rate 3%;

3) A portion of more than $1500 not exceeding 4500 yuan, and a tax rate of 10%;

4) A portion of more than $4500 not exceeding 9000 yuan, and a tax rate of 20%;

5) A portion of more than $9000 not exceeding 35000 yuan, and a tax rate of 25%;

6) A portion of more than $35000 not exceeding 55000 yuan, and a tax rate of 30%;

7) A portion of more than $55000 not exceeding 80000 yuan, and a tax rate of 35%;

8) A portion of more than 80000 yuan, tax rate of 45%;

For example, if Xiao Ming's pre-tax salary is $10000, then a=10000-3500=6500 Yuan, of which no more than $1500 should be taxed 1500x3%=45 yuan, more than $1500 not more than $4500 part of the Taxable (4500-1500) x10%=300 yuan, More than $4500 should be taxed (6500-4500) x20%=400 yuan. A total tax of $745, after-tax income of $9255.

It is known that Xiao Ming this month after-tax income for T Yuan, ask him how much before taxes wages s is how many yuan.

 Input format 

The first line of input contains an integer t, which represents the after-tax income of xiaoming. All the evaluation data to ensure that Xiao Ming's pre-tax salary for a whole hundred number.

  Output format 

Output An integer s that represents Xiaoming's pre-tax salary.

  Sample input

9255

 Sample output

10000

Evaluate use case size and conventions for all evaluation cases, 1≤t≤100000.

  Problem Solving Code

ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {//TODO auto-generated Method Stub        NewMain (). run (); }     Public voidrun () {Scanner SC=NewScanner (system.in); intt =Sc.nextint (); intn = t-3500; intA1 = (int) (1500*0.97); intA2 = (int) (a1+3000*0.9); intA3 = (int) (a2+4500*0.8); intA4 = (int) (a3+26000*0.75); intA5 = (int) (a4+20000*0.7); intA6 = (int) (a5+25000*0.65); ints = 0; if(n<0) {s=T; }Else if(N<=a1 && n>0) {s= (int) (3500+n/0.97); }Else if(N>a1 && n<=A2) {s= (int) (N-A1)/0.9); }Else if(N>a2 && n<=A3) {s= (int) (8000 + (N-A2)/0.8); }Else if(N>a3 && n<=A4) {s= (int) (12500+ (N-A3)/0.75); }Else if(N>a4 && n<=a5) {s= (int) (38500+ (N-A4)/0.7); }Else if(N>a5 && n<=a6) {s= (int) (3500+ (N-A5)/0.65); }Else if(n>a6) {s= (int) (3500+ (N-A6)/0.55);    } System.out.println (s); }}

(This article is only for learning communication, if there is a better way to solve the problem, welcome to communicate with me ~)

CCF 201612-2 Payroll calculation Java Problem solving

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.