Question
specs for FindTwoFirstWords FindTwoFirstWords Write a public class call FindTwoFirstWords with a main method. what it does 1. This class reads any number of Strings
specs for FindTwoFirstWords
FindTwoFirstWords
Write a public class call FindTwoFirstWords with a main method.
what it does
1. This class reads any number of Strings from standard input. 2. When a line containing nothing but the String "0" is read, the program displays the two words that would come first in alphabetical order.
Restrictions
do not use arrays, ArrayLists, or anything not covered in class.
Examples
% java FindTwoFirstWords enter a string (end with 0): Z enter a string (end with 0): z enter a string (end with 0): A enter a string (end with 0): Z enter a string (end with 0): C enter a string (end with 0): c enter a string (end with 0): D enter a string (end with 0): d enter a string (end with 0): 0 first: A second: C % java FindTwoFirstWords enter a string (end with 0): A enter a string (end with 0): a enter a string (end with 0): Z enter a string (end with 0): z enter a string (end with 0): C enter a string (end with 0): c enter a string (end with 0): B enter a string (end with 0): b enter a string (end with 0): F enter a string (end with 0): f enter a string (end with 0): 0 first: A second: B % java FindTwoFirstWords enter a string (end with 0): A enter a string (end with 0): ~ enter a string (end with 0): ` enter a string (end with 0): = enter a string (end with 0): + enter a string (end with 0): 1 enter a string (end with 0): 9 enter a string (end with 0): b enter a string (end with 0): a enter a string (end with 0): B enter a string (end with 0): 0 first: + second: 1 % java FindTwoFirstWords enter a string (end with 0): Hello enter a string (end with 0): hello enter a string (end with 0): ?hello? enter a string (end with 0): good bye enter a string (end with 0): Good Bye enter a string (end with 0): bye enter a string (end with 0): BYE enter a string (end with 0): 0 first: ?hello? second: BYE %
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started