|
A good answer might be:
|
Different SuffixesThe first integer is prompted for outside of the loop. Inside the loop body, it would be nice to use the following prompts: The prompt will show poor grammar for integers 21, 22, 23, 31, 32, 33 and so on. Let us regard this as acceptable.Enter the 2nd integer (enter 0 to quit): Enter the 3rd integer (enter 0 to quit): Enter the 4th integer (enter 0 to quit): Enter the 5th integer (enter 0 to quit): Enter the 6th integer (enter 0 to quit): .... and so on .... Enter the 20th integer (enter 0 to quit): Enter the 21th integer (enter 0 to quit): The statement to write to the monitor will be changed to this: The variable suffix will be a reference to one of the Strings: "nd", "rd", or "th".System.out.println( "Enter the " + (count+1) + suffix + " integer (enter 0 to quit):" ); |
QUESTION 7:A choice must be made from among three things. Can a single if-else statement do this? Click Here after you have answered the question |