Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question #3: New Word Program (6 pts) Write a program that prompts the user for two words with exactly 3 characters. Your program should behave

Question #3: New Word Program (6 pts) Write a program that prompts the user for two words with exactly 3 characters. Your program should behave as follow: 1. Display a welcome message. 2. Store the users two words in two different variables of type string. 3. Echo back to the user the word entered with the length of each word. 4. Use a new string to merge two words, following the sequence: 1st character of the first word + 1st character of the second word + 2nd character of the first word + 2nd character of the second word + 3rd character of the first word + 3rd character of the second word. 5. Display the resulting new word. 6. Display the new word with the 2nd letter and 2nd to last letter after swapping. 7. Display a farewell message, so that the user knows that the program has terminated normally. Restrictions: No looping statements allowed (or needed). This questions requires the use of the functions: length(), substr(). Assumption: Assume a perfect user who will always enter a word with exactly 3 characters.

image text in transcribedimage text in transcribedimage text in transcribed

Question #3: New Word Program (6 pts) Write a program that prompts the user for two words with exactly 3 characters. Your program should behave as follow: 1. Display a welcome message. 2. Store the user's two words in two different variables of type string. 3. Echo back to the user the word entered with the length of each word. 4. Use a new string to merge two words, following the sequence: 1st character of the first word + 1st character of the second word + 2nd character of the first word + 2nd character of the second word + 3rd character of the first word + 3rd character of the second word. 5. Display the resulting new word. 6. Display the new word with the 2nd letter and 2nd to last letter after swapping. 7. Display a farewell message, so that the user knows that the program has terminated normally. Restrictions: No looping statements allowed (or needed). This questions requires the use of the functions: length(), substr(). Assumption: Assume a perfect user who will always enter a word with exactly 3 characters. Following are three sample screen shots to illustrate the expected behavior of your program. Your program is to work with any word with 3 characters entered by the user. User input at the keyboard is marked with a red circle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions