Personal income tax calculation
PackageCom.kaige123.ifelse;/*** Edith * / Public class testifelse {Public static void main(string[] args) {Java.util.Scanner input =NewJava.util.Scanner (system.in); System.out.print ("Please enter your salary:");intGZ = Input.nextint ();intSS =0; GZ-=3500;if(GZ >=0) {if(GZ < the) {//First level 0.3 0SS = (int) (GZ *0.03f);}Else{if(GZ <4500) {//TenSS = (int) (GZ *0.1f- the);}Else{if(GZ <9000) {//555SS = (int) (GZ *0.2f-555);}Else{if(GZ <35000) {//1005SS = (int) (GZ *0.25f-1005);}Else{if(GZ <55000) {//2755SS = (int) (GZ *0.30f-2755);}Else{if(GZ <80000) {//5505SS = (int) (GZ *0.35f-5505);}Else{SS = (int) (GZ *0.45f-13505);}}}}}} System.out.println ("All your taxes to be delivered:"+ SS +"Yuan"); System.out.println ("The rest of the salary:"+ (gz+3500-SS) +"Yuan");}Else{System.out.println ("Your salary is not within the income tax, come on!" ");}}}
Improve if Else
PackageCom.kaige123.ifelse;/*** Edith * / Public class testifelse {Public static void main(string[] args) {Java.util.Scanner input =NewJava.util.Scanner (system.in); System.out.print ("Please enter your salary:");intGZ = Input.nextint ();intSS =0; GZ-=3500;if(GZ >=0) {if(GZ < the) {//First level 0.3 0SS = (int) (GZ *0.03f);}Else if(GZ <4500) {//TenSS = (int) (GZ *0.1f- the);}Else if(GZ <9000) {//555SS = (int) (GZ *0.2f-555);}Else if(GZ <35000) {//1005SS = (int) (GZ *0.25f-1005);}Else if(GZ <55000) {//2755SS = (int) (GZ *0.30f-2755);}Else if(GZ <80000) {//5505SS = (int) (GZ *0.35f-5505);}Else{SS = (int) (GZ *0.45f-13505);} System.out.println ("All your taxes to be delivered:"+ SS +"Yuan"); System.out.println ("The rest of the salary:"+ (GZ +3500-SS) +"Yuan");}Else{System.out.println ("Your salary is not within the income tax, come on!" ");}}}
Personal income tax calculation