Looking at my code, how can I have the text "Enter 3 collections of course codes one collection per line" and the "Size" and the "Sorted" have a different text style and underlined so it's easier to read? Thank you in advance.
public static void main(String[] args) {
LinkedList<String> ListofCourses = new LinkedList<>();
Scanner course = new Scanner(System.in);
String line;
String[] codes;
System.out.println("Ron's Copy");
System.out.println("\nEnter 3 collections of course codes one collection per line");
/**The 'for' statement is used here to output the user input of courses
and loop back to have the user enter another set of courses until the user
input has been completed 3 times successfully */
for (int i = 0; i < 3; i++) {
line = course.nextLine();
codes = line.split(" ");
//This statement adds input from sets
ListofCourses.addAll(Arrays.asList(codes));
//Sorting LinkedList with Collections.sort() method
Collections.sort(ListofCourses);
/*
* The system.out.print statement print out the courses in a sorted
* method and then loops back again to have the user input
*/
System.out.print("\nSize: " + ListofCourses.size() + " Sorted: ");
//The statements below will print sorted courses that were inputted by the user
for (int r = 0; r < ListofCourses.size(); r++) {
System.out.print(ListofCourses.get(r) + " ");
}
System.out.println();
//clear the list so that next iteration gets a fresh empty list
ListofCourses.clear();
}
}