changed if-else example to use JOptionPane