OneCompiler

java program

Write a tax calculation program. Prompt the user to input two salaries for a family and output their combined tax bill. A family pays no tax if its income is less than 15000 euro. The family pays a 10% tax if the combined salaries are for 15000 euro through 19,999 euro, or a 20% tax if the combined salaries are from 20000 euro through 29,999. Otherwise the family pays a 30% tax.

2 Answers

5 years ago by
5 years ago by sng karthik
import java.util.*;

public class HelloWorld {
    public static void main(String[] args) {
        int a,b;
        Scanner s = new Scanner(System.in);
        a=s.nextInt();
        b=s.nextInt();
        if(a+b <= 15000) {
          System.out.println(a+b);
        } else if(a+b > 15000 && a+b < 20000) {
          System.out.println(a+b*1.1);
        } else if (a+b>19999 && a+b < 30000) {
          System.out.println(a+b*1.2);
        } else {
          System.out.println(a+b*1.3);
        }
    }
}

Check output here

5 years ago by Divya