Skip to content

Instantly share code, notes, and snippets.

@AriffAzmi
Created August 27, 2015 18:33
Show Gist options
  • Save AriffAzmi/ccdc9e298f7c91e8b8df to your computer and use it in GitHub Desktop.
Save AriffAzmi/ccdc9e298f7c91e8b8df to your computer and use it in GitHub Desktop.
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