1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import javax.swing.JOptionPane; //Import utilities required for scanner to work public class ConvertUpperToLower{ public static void main(String[] args){ String inputString = JOptionPane.showInputDialog(null, "Please enter an upper case character", "CPSC 1150 Lab 2", JOptionPane.QUESTION_MESSAGE); char uppercase = inputString.charAt(0); int offset = (int)'a' - (int)'A'; char lowercase = (char)((int)uppercase + offset); JOptionPane.showMessageDialog(null, lowercase); //Express result } } |