Question: Write a program that does the following: Create an ArrayList of Strings and call it itinerary Read in destinations from the user until the user
Write a program that does the following:
Create an ArrayList of Strings and call it itinerary
Read in destinations from the user until the user enters done (or DONE,
or dOnE, .. ) As you read in the destinations add them to the itinerary
Next You need to create a String called travelRoute that includes the travel
route as shown in the output
Use a StringBuilder called sb to create the String travelRoute .
Loop through all the elements of the ArrayList itinerary
Change the destinations (e.g. Rome) to all uppercase letters (e.g. ROME) before adding them to sb
Add the word to (lowercase) between the destinations, but not at the end)
When you are done create the string travelRoute based on the information stored in sb.
Print the String travelRoute.
Sample Output:
Destination: London Destination: Paris Destination: Rome Destination: done
travel route: LONDON to PARIS to ROME
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
