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: LStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started