/** * Program gets the number of years you want to borrow * money for a Mortgage and outputs the percentage rate. */ import javax.swing.JOptionPane; class MortgageRates{ public static void main( String [] arg ){ int years = Integer.parseInt(JOptionPane.showInputDialog( "Enter years \n 5, 7, 15 or 30")); String response; switch (years) { case 5: response = "Rate is 4.75"; break; case 7: response = "Rate is 5.0"; break; case 15: response = "Rate is 5.50"; break; case 30: response = "Rate is 6.0"; break; default: response = "Wrong input "; } JOptionPane.showMessageDialog(null, response ); System.exit(0); } }