Answered step by step
Verified Expert Solution
Question
1 Approved Answer
String Character Counter and Reverser Write a Java program that prompts the user to input four strings, stores them in individual String objects, and then
String Character Counter and Reverser
Write a Java program that prompts the user to input four strings, stores them in
individual String objects, and then displays the total number of characters as well as the
strings in reverse order.
The program should:
Prompt the user to input four strings.
Read the input strings from the console using the Scanner.next method.
Store each input string in individual String objects.
Calculate the total number of characters by summing the lengths of all four
strings.
Concatenate the input strings in reverse order.
Display the total number of characters and the concatenated strings in reverse
order.
Write Java code to implement the above requirements. Ensure that the program
follows the given instructions precisely and provides the expected output format.
Once you've completed the implementation, test your program with different sets
of input strings to verify its correctness.
OUTPUT:
Enter four words describing a memorable vacation: beach sun sand waves
With a total of characters, in reverse order, they are: waves sand sun beach
Step 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