Something went wrong. Try again.
A collection of projects I've done for Berks Career and Technology Center Information Technology Programming
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940import javax.swing.JOptionPane;
/* Test Case:
New Mexico (shhh):
Should be: 10 new mexico NEW MEXICO N
*/
public class StringMan{ public static void main(String[] args){ String cityName = JOptionPane.showInputDialog("Enter Your Favourite City's Name: "); if (cityName != null && cityName.length() > 0){ System.out.println("The number of characters in that name is: " + cityName.length()); System.out.println("That name in lowercase is: " + cityName.toLowerCase()); System.out.println("That name in uppercase is: " + cityName.toUpperCase()); System.out.println("The first letter of that name is: " + cityName.charAt(0)); } else { System.out.println("Name cannot be empty!"); } } }