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 four words. Your program should behave

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, if the word is
Ann, then the entered number should be less than 3(the length of Ann).
4. Create a new word, which merges the substring of 3 words. If the entered
number is even, the substring starts from the first letter; if is it 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.
Restriction: This questions requires the use of the functions: length(), substr().
Assumption: Assume a perfect user who will always enter the correct input values.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 3: 2
Please enter the 3rd number less than 9: 6
The new word is: aryHaElepha
Thank you for using New Word Program!
Figure 4- Sample output #1 for Question 3Welcome to New Word Program
Please enter 3 words : How Are You???
Please enter the 1st number less than 3:1
Please enter the 2nd number less than 3:2
Please enter the 3rd number less than 6: 3
The new word is: oArou?
Thank you for using New Word Program!
Figure 5- Sample output #2 for Question 3
image text in transcribed

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

Learn Mysql The Easy Way A Beginner Friendly Guide

Authors: Kiet Huynh

1st Edition

B0CNY7143T, 979-8869761545

More Books

Students also viewed these Databases questions

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago

Question

identify current issues relating to equal pay in organisations

Answered: 1 week ago