Scanner keyboard = new Scanner(System.in);
System.out.print("Please Enter A String");
String first = keyboard.next();
Write a Java program that will prompt and read a series of strings from the user. Processing will stop when the user enters the string quit. The program will print the number of strings entered (excluding the string quit), the average string length, and the number of possible words. A possible word is a string that contains only letters.
Sample run:
Please enter a string: cat
Please enter a string: Dog
Please enter a string: hamster
Please enter a string: 1234
Please enter a string: quit
Number of strings: 4
Average string length: 4.25
Number of possible words: 3

New Topic/Question
Reply



MultiQuote



|