Question: Write a Java program that asks the user to enter the name of his or her favorite city. Use a String variable to store the
Write a Java program that asks the user to enter the name of his or her favorite city. Use a String variable to store the input. The program should display the following:
The number of characters in the city name
The name of the city in all uppercase letters The name of the city in all lowercase letters The first character in the name of the city
Please refer to the test cases below for the exact input/output messages.
TestCase1:
Enter the name of your favorite city: Los Angeles You Entered: Los Angeles Uppercase: LOS ANGELES Lowercase: los angeles Number of Characters: 11 First Character: L
TestCase2
Enter the name of your favorite city: Santa Monica You Entered: Santa Monica Uppercase: SANTA MONICA Lowercase: santa monica Number of Characters: 12 First Character: S
Example: Los Angeles

1 Enter the name of your favorite city: 2 You Entered: Los Angeles 3 Uppercase: LOS ANGELES 4 Lowercase: los angeles 5 Number of Characters: 11 6 First Character: L
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
