Question: 3. Write a program that will prompt for the secret word (which is Terps). If the user puts in Terps, output Correct. Otherwise, let

3. Write a program that will prompt for the secret word (which 

3. Write a program that will prompt for the secret word (which is Terps). If the user puts in Terps, output Correct. Otherwise, let the user know if the word they entered has Less characters than the secret word, the Same amount, or More characters. Use the nextLine() method to read the input and you can assume the user will type in an actual word for the input. The program should be case sensitive (i.e. Terps is not terps) and remember to not use to check if they entered Terps (you should know what to do instead, so don't ask the TA ). You can use the String method length to get the number of characters in a word. For example, the following code would output 5 since hello has 5 characters in it. String s "hello"; System.out.print (s.length()); Here are 4 different sample runs (with user input in italic and output in bold just to make it easier to understand how it works). Enter the secret word: Terps Correct Enter the secret word: hi Less Enter the secret word: table Same Enter the secret word: Penguin More

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!