Question: Write a program that prompts the user to enter three strings. Compare the String objects lexicographically (alphabetically) and print the strings out in alphabetical order.
Write a program that prompts the user to enter three strings. Compare the String objects lexicographically (alphabetically) and print the strings out in alphabetical order. For example, if the three input strings were "abcd", "wxyz", and "pqrs", the program would print:
abcd pqrs wxyz
Make a list of values for str1, str2, and str3 that would thoroughly test the code.
Sample Run 1:
Enter string 1: aaaa Enter string 2: cccc Enter string 3: bbbb aaaa bbbb cccc
Sample Run 2:
Enter string 1: bob Enter string 2: chris Enter string 3: andy andy bob chris
Sample Run 3
Enter string 1: aaa Enter string 2: a Enter string 3: aa a aa aaa
Please use if else (Decision) statement. Do Not use arrays or ArrayLists
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
