Question: Write a program which prompts the user for three Strings , then sorts and displays them in lexicographic order on your screen: If the user
Write a program which prompts the user for three Strings, then sorts and displays them in lexicographic order on your screen:
- If the user enters "quit" at any prompt, then your program should end
- Strip off any leading blanks in the Strings before sorting
A sample dialog is below (user input is in italics and underlined):
Please enter three Strings below: String 1: Now is the time for all good men String 2: We the people String 3: Ask not what your country can do for you Those Strings in lexicographic order are: 1. Ask not what your country can do for you 2. Now is the time for all good men 3. We the people
Run your program on the following test data sets. User input is in italics and underlined:
Data set 1 (note the spaces in front of the first entry): String 1: Baker String 2: Charlie String 3: Able
Data set 2: String 1: 9 String 2: 1000 String 3: One thousand
Data set 3: String 1: miracosta String 2: MIRACOSTA String 3: MiraCosta
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
