Advertisement
Guest User

rg

a guest
May 22nd, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class age {
  3.  
  4. public static void main(String[] args) {
  5. String SAmount;
  6. double age =0;
  7. double pay =0;
  8. double tax =0;
  9.  
  10. SAmount = JOptionPane.showInputDialog(null,"Please enter your age", "AMOUNT", JOptionPane.QUESTION_MESSAGE);
  11. age = Double.parseDouble(SAmount);
  12. SAmount = JOptionPane.showInputDialog(null,"Please enter your pay", "AMOUNT", JOptionPane.QUESTION_MESSAGE);
  13. pay = Double.parseDouble(SAmount);
  14.  
  15. if (age < 0){
  16. System.out.println ("One of the values is not valid");
  17. }
  18.  
  19. else if (age < 18){
  20. System.out.println ("You owe nothing");
  21. }
  22.  
  23. else if (age <= 25){
  24. tax = (int) (pay * 0.25);
  25. System.out.println ("You owe 25% in taxes $" + tax);
  26. }
  27.  
  28. else if (age <= 35){
  29. tax = (int) (pay * 0.35);
  30. System.out.println ("You owe 35% in taxes $" + tax);
  31. }
  32.  
  33. else if (age <= 55){
  34. tax = (int) (pay * 0.55);
  35. System.out.println ("You owe 45% in taxes $" + tax);
  36. }
  37.  
  38. else if (age <= 64){
  39. tax = (int) (pay * 0.64);
  40. System.out.println ("You owe 20% in taxes $" + tax);
  41. }
  42.  
  43. else{
  44. System.out.println ("You owe nothing");
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement