Question: Question #3: New Word Program (6 pts) Write a program that prompts the user for four words. Your program should behave as follow: 1 Display
Question #3: New Word Program (6 pts) Write a program that prompts the user for four words. Your program should behave as follow: 1 Display a welcome message. 2 Ask the user to prompt 3 words with at least 1 letter. 3. Ask the user to prompt 3 numbers, that should be less than the length of each word to indicate length of substring in each word. For example, the word is Ann, then the entered number should be less than 3 (the length of Ann). 4. Create a new word, which merge the substring of 3 words. If the entered number is even, the substring starts from the first letter; If it is odd, the substring starts from the second letter. 5. Display the resulting new word. 6. Display a farewell message, so that the user knows that the program has terminated normally. Comp 218/Winter 2022 Page 4 of 5 Assignment #1 Restrictions: This questions requires the use of the functions: length(), substr(). Assumption: Assume a perfect user who will always enter the correct input values. Following are three sample screen shots to illustrate the expected behavior of your program. Your program is to work with any words entered by the user. User input at the keyboard is marked with a red circle Welcome to New Word Program Please enter 3 words: Mary Has Elephants Please enter the 1st number less than 4:3 Please enter the 2nd number less than 3502 Please enter the 3rd number less than 9:06 The new word is: aryHaElepha Thank you for using New Word Program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
