Question: Write a program that asks the user for a noun and two verbs (inspired by a Colgate University COSC 101 program). Using the words the

 Write a program that asks the user for a noun and

Write a program that asks the user for a noun and two verbs (inspired by a Colgate University COSC 101 program). Using the words the user entered, print out a new sentence of the form: If it VERB1 like a NOUN and VERB2 like a NoUN, it probably is a NoUN. 0 A sample run of the program: Enter a noun: duck Enter another verb: talks New sentence: If it walks like a duck and talks like a duck, it probably is a duck Another sample run of the program: Enter a noun: cat Enter a verb: sounds Enter another verb: moves New sentence: If it sounds like a cat and moves like a cat, it probably is a cat. oO Hint: Here's a way to approach the problem: 1. Create a variable, templateString and store the stringIf t VERBI like a NOUN and VER32 like a Non, it probably is a NOUM..tit. 2. Ask the user for a noun and store it in a variable, noun 3. Replace the placeholder in the template with the noun the user entered (i.e. template - template.replace( "NOUN", oun). 4. Ask the user for a noun and store it in a variable, verbl 5. Replace the placeholder in the template with the verb the user entered. 6. Ask the user for another verb and store it in a variable, verb2. 7. Replace the placeholder in the template with the second the verb the user entered. 8.Print out the updated template string

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 Databases Questions!