Write a program that reads in three strings and prints them in lexicographically sorted order:

Please enter three strings:
Tom
Dick
Harry
The inputs in sorted order are:
Dick
Harry
Tom

Complete the following files:

StringSet.java

/** This class finds the smallest, middle, and largest of three strings. */ public class StringSet { . . . /** Constructs a string set that processes three strings. @param str1 the first string to sort @param str2 the second string to sort @param str3 the third string to sort */ public StringSet(String str1, String str2, String str3) { . . . } /** Gets the smallest string in the string set. @return smallest the smallest of three strings */ public String getSmallest() { . . . } /** Gets the largest string in the string set. @return largest the largest of three strings */ public String getLargest() { . . . } /** Gets the middle string in the string set. @return middle the middle string of three strings */ public String getMiddle() { . . . } }

StringSetTester.java

Use the following file:

StringSorter.java

import java.util.Scanner;

/**
   This program sorts three strings.
*/
public class StringSorter
{
   public static void main(String[] args)
   {
      Scanner in = new Scanner(System.in);
      
      System.out.println("Please enter three strings:");
      String str1 = in.nextLine();
      String str2 = in.nextLine();
      String str3 = in.nextLine();

      StringSet s = new StringSet(str1, str2, str3);

      System.out.println("The inputs in sorted order are:\n"
         + s.getSmallest() + "\n"
         + s.getMiddle() + "\n"
         + s.getLargest());
   }
}