Created
August 27, 2015 18:33
-
-
Save AriffAzmi/ccdc9e298f7c91e8b8df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package incometax; | |
import java.util.Scanner; | |
public class IncomeTax | |
{ | |
public static void main(String[] args) | |
{ | |
String name; | |
double salary, result; | |
// Initialize Scanner object | |
Scanner konsole = new Scanner(System.in); | |
System.out.print("Enter your name: "); | |
name = konsole.nextLine(); | |
System.out.print("Enter your Annual Salary: RM "); | |
salary = konsole.nextDouble(); | |
if (salary <= 50000.00) | |
{ | |
result = (1.00/100.00) * salary; | |
} | |
else if (salary <= 75000.00) | |
{ | |
result = (2.00/100.00) * salary; | |
} | |
else if (salary <= 100000.00) | |
{ | |
result = (3.00/100.00) * salary; | |
} | |
else if (salary <= 250000.00) | |
{ | |
result = (4.00/100.00) * salary; | |
} | |
else if (salary <= 500000.00) | |
{ | |
result = (5.00/100.00) * salary; | |
} | |
else | |
{ | |
result = (6.00/100.00) * salary; | |
} | |
System.out.println("Greetings, " + name +"!\n" + "Welcome to our tax calculator program! " | |
+ "To double confirmed, your annual income is: RM " + salary + | |
"\nThe amount of tax that you need to pay with your income is RM " + | |
result + ".\nThank you for using our system!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment