import javax.swing.JOptionPane; //Needed for creation Dialog Box public class Ex11AndOr { public static void main(String[] args) { double salary, yearsOnJob; String input; //to hold string input input = JOptionPane.showInputDialog("Enter your annual salary:"); salary = Double.parseDouble(input); //System.out.print(salary+"\n"); input = JOptionPane.showInputDialog("Enter your numbers of years at your current job:"); yearsOnJob = Double.parseDouble(input); //System.out.print(yearsOnJob+"\n"); //determine whether the user qualifies for the housing loan, both must be true if (salary >= 30000 && yearsOnJob >=2) { JOptionPane.showMessageDialog(null, "You qualified for the housing loan."); } else { JOptionPane.showMessageDialog(null, "You do NOT qualify for the housing loan."); } //determine whether the user qualifies for the cash loan, only one needs to be true if (salary >= 30000 || yearsOnJob >=2) { JOptionPane.showMessageDialog(null, "You qualified for the cash loan."); } else { JOptionPane.showMessageDialog(null, "You do NOT qualify for the cash loan."); } System.exit(0); //exit properly } }