Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lessons;
- //program that determines in a bank customer qualifies foe special interest rate
- //to qualify: salary must be minimum 30k annually
- // customer must have held said job for 2 years minimum
- import javax.swing.JOptionPane;
- public class NestedIfStatments
- {
- public static void main(String[] args)
- {
- double salary;
- int job;
- String s1;
- s1 = JOptionPane.showInputDialog("what is your annual salary?");
- salary = Double.parseDouble(s1);
- if (salary >= 30_000.00)
- {
- s1 = JOptionPane.showInputDialog("how many years have you worked at your job?");
- job = Integer.parseInt(s1);
- if (job >= 2 )
- {
- JOptionPane.showMessageDialog(null,"Congradulations, you are elegible for the special interest rate!");
- }
- else
- {
- JOptionPane.showMessageDialog(null,"Sorry, you need to have held this job for minimum 2 years");
- }
- }
- else
- {
- JOptionPane.showMessageDialog(null,"Sorry, to qualify you must have an annual minimum salary of 30,000.00");
- }
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement