Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. package u5715280;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Question1 {
  6.  
  7. public static void main(String[] args) {
  8. Scanner s = new Scanner(System.in);
  9. int in, tax,income;
  10. int acc = 0;
  11. int total = 0;
  12. while (true) {
  13. System.out
  14. .print("Enter your income (input 0 or negative number to terminate) :");
  15. in = s.nextInt();
  16. tax = (in * 3) / 100;
  17. income = in - tax;
  18. if (in > 0) {
  19. System.out.println("Tax = " + tax);
  20. System.out.println("Income (After Tax) = " + income);
  21. System.out.println("Accumulated Tax Withheld = " + (acc+tax));
  22. System.out.println("Total Income (After Tax) = "
  23. + (total + income));
  24. acc += tax;
  25. total += income;
  26. } else {
  27. System.out.println("Withholding Tax Summary");
  28. System.out.println("-----------------------");
  29. System.out.println("Accumulated Tax Withheld = " + (acc+tax));
  30. System.out.println("Total Income (After Tax) = "
  31. + (total + income));
  32. }
  33. }
  34.  
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement