Skip to content

Instantly share code, notes, and snippets.

@AriffAzmi
Created August 27, 2015 17:51
Show Gist options
  • Save AriffAzmi/9742aeae3c8ffdd2fda0 to your computer and use it in GitHub Desktop.
Save AriffAzmi/9742aeae3c8ffdd2fda0 to your computer and use it in GitHub Desktop.
package incometax;
import java.util.Scanner;
/**
*
* @author ariff
*/
public class IncomeTax {
public static void main(String[] args) {
int salary;
double result;
String name;
Scanner in = new Scanner(System.in);
System.out.println("Enter your name:");
name = in.nextLine();
System.out.println("Enter your Annual Salary:");
salary = in.nextInt();
if (salary <= 50000) {
result = (1/100) * salary;
System.out.println("Greetings," + name +"!" +
"Welcome to our tax calculator program!\n."
+ "To double confirmed, your annual income is:" + salary +
"\nThe amount of tax that you need to pay with your income is" + " " + result +
"\nThank you for using our system!");
}
else if (salary <= 75000) {
result = (2/100) * salary;
System.out.println("Greetings," + name +"!" +
"Welcome to our tax calculator program!\n."
+ "To double confirmed, your annual income is:" + salary +
"\nThe amount of tax that you need to pay with your income is" +
result + "\nThank you for using our system!");
}
else if (salary <= 100000) {
result = (3/100) * salary;
System.out.println("Greetings," + name +"!" +
"Welcome to our tax calculator program!\n."
+ "To double confirmed, your annual income is:" + salary +
"\nThe amount of tax that you need to pay with your income is" +
result + "\nThank you for using our system!");
}
else if (salary <= 250000) {
result = (4/100) * salary;
System.out.println("Greetings," + name +"!" +
"Welcome to our tax calculator program!\n."
+ "To double confirmed, your annual income is:" + salary +
"\nThe amount of tax that you need to pay with your income is" +
result + "\nThank you for using our system!");
}
else if (salary <= 500000) {
result = (5/100) * salary;
System.out.println("Greetings," + name +"!" +
"Welcome to our tax calculator program!\n."
+ "To double confirmed, your annual income is:" + salary +
"\nThe amount of tax that you need to pay with your income is" +
result + "\nThank you for using our system!");
}
else if (salary > 500000) {
result = (6/100) * salary;
System.out.println("Greetings," + name +"!" +
"Welcome to our tax calculator program!\n."
+ "To double confirmed, your annual income is:" + salary +
"\nThe amount of tax that you need to pay with your income is" +
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