Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are required to write a program that accepts 5 input stringsfrom the user. A

ID: 3610367 • Letter: Y

Question

You are required to write a program that accepts 5 input stringsfrom the user. After sorting strings into ascending order thestring will be displayed.

Detailed Description:

1. Declare a character type string array.

2. Use for loop

3. Get five string values from the user

4. Sort them in ascending order

5. Display them after sorting

6. Ascending order means string values starting from‘a’ will come first, and then starting from‘b’ and so on.

Sample Output

enter string1 : Muhammad

enter string2 : Abdullah

enter string3 : Usman

enter string4 : Ali

enter string5 : Noureen

Sorted string

Abdullah

Ali

Muhammad

Noureen

Usman

Explanation / Answer

import java.io.*; import java.util.*; import java.lang.*; public class Ascend{ public static void main(String args[]){ String[] names = new String[5]; System.out.print("Enter the Strings: "); String s=""; for (int i=0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote