import javax.swing.*; // enables us to use JOptionPane public class InputDialogs { public InputDialogs() { String name; name = JOptionPane.showInputDialog(null, "Enter Name"); System.out.println("Name is: " + name); String salaryStr; salaryStr = JOptionPane.showInputDialog(null, "Enter current salary"); double salary = Double.parseDouble(salaryStr); salary *= 2; // raise System.out.println("New Salary is: " + salary); String yearsStr = JOptionPane.showInputDialog(null, "How many years have you been programming?"); String programmerType; int years = Integer.parseInt(yearsStr); if (years <= 10) { programmerType = "Professional"; } else { programmerType = "Expert"; } JOptionPane.showMessageDialog(null, programmerType, "Programmer Type", JOptionPane.INFORMATION_MESSAGE); } public static void main(String[] args) { new InputDialogs(); System.exit(0); // Necessary because GUI "thread" is still running } }