Please write a program that prints the woodchuck tongue twister when run with the given input sequence of strings. Please note that spaces (" ") must be present in the output, capital letters are not the same as lowercase, and it should end with "!".

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

I need help at this question. Please provide accurately answer with details. Please solve this questions as formating shows in question. 

### Educational Programming Exercise: Constructing Strings Using Input Variables

#### Objective:
Write a program that outputs the woodchuck tongue twister when run with the specific input sequence of strings. Note that spaces (" ") must be included in the output, capital letters are distinct from lowercase, and the output should end with '!'.

#### Input:
The program receives a sequence of strings in the following order:
- "If a"
- "wood"
- "chuck"
- "could"
- "."
- "then"
- "the"
- "would"
- "!"
- "as"
- "much"
- "!"

#### Output:
The expected output is:
```
If a woodchuck could chuck wood then the woodchuck would chuck as much wood as the woodchuck would!
```

#### Constraints:
Ensure every line of your code is identical to one of the lines provided below. This constraint helps focus on concatenation using input variables.

#### Code Guidelines:

**Use these lines once in your program:**
```java
String message = input();     // Line to initialize the message
String wood = input();        // Line to store the string "wood"
String chuck = input();       // Line to store the string "chuck"
String could = input();       // Line to store the string "could"
String the = input();         // Line to store the string "the"
String as = input();          // Line to store the string "as"
String much = input();        // Line to store the string "much"
String a = input();           // Line to store the string "!"
print message;                // Line to print the final message
```

**Use these lines repeatedly in your program:**
```java
message = message + wood + chuck;     // Concatenate "wood" and "chuck"
message = message + input();          // Concatenate input to message
message = message + message;          // Duplicate the message
message = message + wood;             // Concatenate "wood"
message = message + as;               // Concatenate "as"
message = message + much;             // Concatenate "much"
message = message + could;            // Concatenate "could"
message = message + chuck;            // Concatenate "chuck"
```

**Example of Incorrect Code:**
Do not use any other lines of code in your program.
```java
String message = input();     // This initializes
Transcribed Image Text:### Educational Programming Exercise: Constructing Strings Using Input Variables #### Objective: Write a program that outputs the woodchuck tongue twister when run with the specific input sequence of strings. Note that spaces (" ") must be included in the output, capital letters are distinct from lowercase, and the output should end with '!'. #### Input: The program receives a sequence of strings in the following order: - "If a" - "wood" - "chuck" - "could" - "." - "then" - "the" - "would" - "!" - "as" - "much" - "!" #### Output: The expected output is: ``` If a woodchuck could chuck wood then the woodchuck would chuck as much wood as the woodchuck would! ``` #### Constraints: Ensure every line of your code is identical to one of the lines provided below. This constraint helps focus on concatenation using input variables. #### Code Guidelines: **Use these lines once in your program:** ```java String message = input(); // Line to initialize the message String wood = input(); // Line to store the string "wood" String chuck = input(); // Line to store the string "chuck" String could = input(); // Line to store the string "could" String the = input(); // Line to store the string "the" String as = input(); // Line to store the string "as" String much = input(); // Line to store the string "much" String a = input(); // Line to store the string "!" print message; // Line to print the final message ``` **Use these lines repeatedly in your program:** ```java message = message + wood + chuck; // Concatenate "wood" and "chuck" message = message + input(); // Concatenate input to message message = message + message; // Duplicate the message message = message + wood; // Concatenate "wood" message = message + as; // Concatenate "as" message = message + much; // Concatenate "much" message = message + could; // Concatenate "could" message = message + chuck; // Concatenate "chuck" ``` **Example of Incorrect Code:** Do not use any other lines of code in your program. ```java String message = input(); // This initializes
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr