Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4. public class YearlySalary {
  5. public static void main(String[] args) {
  6. double tax;
  7. Decimalformat df = new DecimalFormat("0.00");
  8. Scanner scan = new Scanner(System.in);
  9. System.out.println("Enter your yearly Salary -");
  10. double salary = scan.nextDouble();
  11. scan.close();;
  12. if (salary <= 20000.00) {
  13. System.out.println("Your tax is 0");
  14. }
  15. else if (salary > 20000.00) {
  16. tax = salary * 0.1;
  17. System.out.println(String.format("Your tax is :" + df.format(tax)));
  18. }
  19. else if (salary > 40000.00 && salary <= 60000.00) {
  20. tax = slary * 0.2;
  21. System.out.println(String.format("Your tax is :" + df.format(tax)));
  22. }
  23. else if (salary > 60000.00) {
  24. tax = slary * 0.3;
  25. System.out.println(String.format("Your tax is :" + df.format(tax)));
  26. }
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement