Description Write a program that prints the words in a given sentence in lexicographical order, not case-sensitive. [CON

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Description Write a program that prints the words in a given sentence in lexicographical order, not case-sensitive. [CON

Post by answerhappygod »

Description
Write a program that prints the words in a given sentence in
lexicographical order, not case-sensitive.
[CONDITIONS]
1) // Code can be written only in the part of your code
here.
Input
No input.
Output
See sample output 1.
Sample output:
a city in is Korea largest Seoul
?boy All come dreams my true will
Hi
123th Busan. in is That visit your
hint:
It is better to use StringTokenizer . (not required)
It is better to use the compareToIgnoreCase method of String. (not
required)
Dictionary arrangement: Special symbol < Number < .. <
Uppercase English alphabet < .. < Lowercase English
alphabet
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {

String str1 = "Seoul is a largest city in Korea";
String str2 = "All my dreams will come true ?boy";
String str3 = "Hi";
String str4 = "";
String str5 = "That is your 123th visit in Busan.";

String[] strs = {str1, str2, str3, str4, str5};

for (int i = 0; i < strs.length; i++) {
String str = strs;

// your code here
System.out.print(str);
System.out.println();
}
}
}
plz use java
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply