//This imports the scanner class used to get user info import java.util.Scanner; //This is the calss name, must be the same as the file name.java public class Assignment3 { public static void main (String args[]) { //Name of the scanner Scanner scan = new Scanner (System.in); //This segment gets the strings from the user. System.out.println ( "Please enter a string. "); String stringOne = scan.next(); System.out.println ( stringOne); System.out.println ( "Please enter another string. "); String stringTwo = scan.next(); //This segment gets the strings from the user and then determines whether they are ven or odd if ((stringOne.length() % 2) == 0) System.out.println ( " The first string is even"); else System.out.println ( " The first string is odd"); if ((stringTwo.length() % 2) == 0) System.out.println ( " The second string is even\n"); else System.out.println ( " The second string is odd\n"); // This determines whether the two strings are identical if (stringOne.equals (stringTwo)) System.out.println ( " The two strings are the same\n"); else System.out.println ( " The two string are the different\n"); //This determines which string is longer. if (stringOne.length() < stringTwo.length()) System.out.println ( " The second string is lexically larger\n"); else System.out.println ( " The first string is lexically larger\n"); //This prints the first character of both the strings System.out.println ( " The first character of the first string is " + stringOne.charAt(0)); System.out.println ( " The first character of the second string is " + stringTwo.charAt(0)); System.out.println (); //This will concatenate both of the strings together with " " around the concatination System.out.println ( " The concatenation of two string is " + "\"" + (stringOne + stringTwo) +"\""); System.out.println (); //This will change both of the strings to upper case System.out.println ( " The first string using upper case letters: " + stringOne.toUpperCase() ); System.out.println ( " The second string using upper case letters: " + stringTwo.toUpperCase() ); } }