In: Computer Science
In a file called LengthSum.java, write a program that:
For example: if the user enters strings "UT" and "Arlington", your program output should look EXACTLY like this:
Please enter a string: UT Please enter a second string: Arlington The first string has length 2. The second string has length 9. The sum of the two lengths is 11.
Your program's output should match EXACTLY the format shown above. There should be no deviations, no extra spaces or lines, no extra punctuation in your output. What you see above as uppercase letters should remain uppercase in your output, what you see as lowercase letters should remain as lowercase in your output, what you see as spaces and punctuation should remain exactly as spaces and punctuation in your output.
//LengthSum.java import java.util.Scanner; public class LengthSum { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1, s2; System.out.print("Please enter a string: "); s1 = in.nextLine(); System.out.print("Please enter a second string: "); s2 = in.nextLine(); System.out.println("The first string has length "+s1.length()+"."); System.out.println("The second string has length "+s2.length()+"."); System.out.println("The sum of the two lengths is "+(s1.length()+s2.length())+"."); } }