// Allison Obourn, CSE 142 // Prompts the user for words until they type quit. // Reports the total number of characters typed. import java.util.*; public class WordSum { public static final String SENTINEL = "quit"; public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("Type a word (\"" + SENTINEL + "\" to exit): "); String word = console.next(); int count = 0; while(!word.equals(SENTINEL)) { count += word.length(); System.out.print("Type a word (\"" + SENTINEL + "\" to exit): "); word = console.next(); } System.out.println("You typed " + count + " characters!"); } }