Advertisement
476179

NestedIfStatments

Oct 24th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. package lessons;
  2. //program that determines in a bank customer qualifies foe special interest rate
  3. //to qualify: salary must be minimum 30k annually
  4. // customer must have held said job for 2 years minimum
  5. import javax.swing.JOptionPane;
  6. public class NestedIfStatments
  7. {
  8.  
  9. public static void main(String[] args)
  10. {
  11. double salary;
  12. int job;
  13. String s1;
  14. s1 = JOptionPane.showInputDialog("what is your annual salary?");
  15. salary = Double.parseDouble(s1);
  16.  
  17. if (salary >= 30_000.00)
  18. {
  19. s1 = JOptionPane.showInputDialog("how many years have you worked at your job?");
  20. job = Integer.parseInt(s1);
  21. if (job >= 2 )
  22. {
  23. JOptionPane.showMessageDialog(null,"Congradulations, you are elegible for the special interest rate!");
  24. }
  25. else
  26. {
  27. JOptionPane.showMessageDialog(null,"Sorry, you need to have held this job for minimum 2 years");
  28. }
  29. }
  30. else
  31. {
  32. JOptionPane.showMessageDialog(null,"Sorry, to qualify you must have an annual minimum salary of 30,000.00");
  33. }
  34. System.exit(0);
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement