/*********************************************************** * Author: Eric Heim * Date Due: June 6th * Course: CS0007 * Description: This program takes in a first and last name * into a single string variable, prints the * full name, the name's initials and the * Unicode sum of the two initials. ***********************************************************/ import java.util.Scanner; public class Project1 { public static void main(String[] args) { String fullName; //String to hold the entered name String initials; //String to hold the entered name's initials int initialsSum; //Integer to hold the sum of the initials' Unicode sum //Scanner object to get standard input Scanner keyboard = new Scanner(System.in); //Prompt the user for a first and last name and get input System.out.print("Please enter your first and last name " + "separated by a space: "); fullName = keyboard.nextLine(); //Get the initials initials = "" + fullName.charAt(0) + fullName.charAt(fullName.indexOf(" ")+1); //Sum the Unicode values of the initials initialsSum = fullName.charAt(0) + fullName.charAt(fullName.indexOf(" ")+1); //Print the entered name System.out.println("Hello, " + fullName + "!"); //Print the entered name's initials System.out.println("Your initials are " + initials); //Print the Unicode sum of the entered name's initials System.out.println("The sum of your initials (in Unicode) is " + initialsSum); } }