Write a program that solves this problem using selection structures and concatenation. Input #1: Any String. Input #2: "size 1" or Any other String. Input #3: "pet 1", or "pet 2". pr "pet 3", pr Any other String. Output: 1 string built and printed according to following Algorithm: Declare a string variable called message and initialize it as the empty string "". If Input #1 is "definite article", then add the string "The "to the message. - If Input #1 is "indefinite article", then add the string "A" to the message. (Don't do anything if Input #1 is neither "definite article", nor "indefinite article.".) If Input #2 is "size 1", then add the string "big "to the message. Otherwise, add the string "small" to the message. If Input #3 is "pet If Input #3 is "pet 1", then add the string "cat." to the message and print message. 2", then add the string "dog." to the message and print message. If Input #3 is "pet 3", then add the string "rat." to the message and print message. If Input #3 is any other value, don't print message and instead print "ERROR". Examples IN: "definite article", "size 1", "pet 1" OUT: "The big cat." IN: "indefinite article", "size 2", "pet 2" OUT: "A small dog." IN: "Antecedent", "size 3", "pet 3" OUT: "small rat." IN: "definite article", "size 1", "Alligator" OUT: "ERROR" IN: "definite article", "big", "pet 1" OUT: "The small cat." IN: "indefinite article", "big", "pet 1" OUT: "A small cat." IN: OUT: "small dog." "", "pet 2"
Write a program that solves this problem using selection structures and concatenation. Input #1: Any String. Input #2: "size 1" or Any other String. Input #3: "pet 1", or "pet 2". pr "pet 3", pr Any other String. Output: 1 string built and printed according to following Algorithm: Declare a string variable called message and initialize it as the empty string "". If Input #1 is "definite article", then add the string "The "to the message. - If Input #1 is "indefinite article", then add the string "A" to the message. (Don't do anything if Input #1 is neither "definite article", nor "indefinite article.".) If Input #2 is "size 1", then add the string "big "to the message. Otherwise, add the string "small" to the message. If Input #3 is "pet If Input #3 is "pet 1", then add the string "cat." to the message and print message. 2", then add the string "dog." to the message and print message. If Input #3 is "pet 3", then add the string "rat." to the message and print message. If Input #3 is any other value, don't print message and instead print "ERROR". Examples IN: "definite article", "size 1", "pet 1" OUT: "The big cat." IN: "indefinite article", "size 2", "pet 2" OUT: "A small dog." IN: "Antecedent", "size 3", "pet 3" OUT: "small rat." IN: "definite article", "size 1", "Alligator" OUT: "ERROR" IN: "definite article", "big", "pet 1" OUT: "The small cat." IN: "indefinite article", "big", "pet 1" OUT: "A small cat." IN: OUT: "small dog." "", "pet 2"
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 3PE
Related questions
Question
I need acurate answer with explanation so, please solve it carefully.
![II!
Assignment 3b - Logic
n
6
of 8
X PDF Assignment 3, Strings and Logic. X +
Ⓒ File | C:/Users/jamil/Downloads/Assignment%203,%20Strings%20and%20Logic.pdf
Q
+
(0)
CD Page view A Read aloud |
Add textDraw
Write a program that solves this problem using selection structures and concatenation.
Input #1: Any String.
Input #2: "size 1" or Any other String.
Input #3: "pet 1", or "pet 2". pr "pet 3", pr Any other String.
Output: 1 string built and printed according to following Algorithm:
Declare a string variable called message and initialize it as the empty string ""
If Input #1 is "definite article", then add the string "The "to the message.
If Input #1 is "indefinite article", then add the string "A" to the message.
(Don't do anything if Input #1 is neither "definite article", nor "indefinite article.".)
If Input #2 is "size 1", then add the string "big "to the message.
Otherwise, add the string "small "to the message.
If Input #3 is "pet
If Input #3
1", then add the string "cat." to the message and print message
2", then add the string "dog." to the message and print message.
"pet
If Input #3 is "pet 3", then add the string "rat." to the message and print message.
If Input #3 is any other value, don't print message and instead print "ERROR".
Examples
IN: "definite article", "size 1", "pet 1"
OUT: "The big cat."
IN: "indefinite article", "size 2", "pet 2"
OUT: "A small dog."
IN: "Antecedent", "size 3", "pet 3"
OUT: "small rat."
IN: "definite article", "size 1", "Alligator"
OUT: "ERROR"
IN: "definite article", "big", "pet 1"
OUT: "The small cat."
IN: "indefinite article", "big", "pet 1"
OUT: "A small cat."
V
IN: **.**.
"", "pet 2"
OUT: "small dog."
Highlight
Erase
Q
8
7
503
x](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa471b51a-0850-4e57-a059-1b322d7c0961%2Fd6e7214c-c689-4570-b14e-188bea7aa54d%2Fic3ilm_processed.png&w=3840&q=75)
Transcribed Image Text:II!
Assignment 3b - Logic
n
6
of 8
X PDF Assignment 3, Strings and Logic. X +
Ⓒ File | C:/Users/jamil/Downloads/Assignment%203,%20Strings%20and%20Logic.pdf
Q
+
(0)
CD Page view A Read aloud |
Add textDraw
Write a program that solves this problem using selection structures and concatenation.
Input #1: Any String.
Input #2: "size 1" or Any other String.
Input #3: "pet 1", or "pet 2". pr "pet 3", pr Any other String.
Output: 1 string built and printed according to following Algorithm:
Declare a string variable called message and initialize it as the empty string ""
If Input #1 is "definite article", then add the string "The "to the message.
If Input #1 is "indefinite article", then add the string "A" to the message.
(Don't do anything if Input #1 is neither "definite article", nor "indefinite article.".)
If Input #2 is "size 1", then add the string "big "to the message.
Otherwise, add the string "small "to the message.
If Input #3 is "pet
If Input #3
1", then add the string "cat." to the message and print message
2", then add the string "dog." to the message and print message.
"pet
If Input #3 is "pet 3", then add the string "rat." to the message and print message.
If Input #3 is any other value, don't print message and instead print "ERROR".
Examples
IN: "definite article", "size 1", "pet 1"
OUT: "The big cat."
IN: "indefinite article", "size 2", "pet 2"
OUT: "A small dog."
IN: "Antecedent", "size 3", "pet 3"
OUT: "small rat."
IN: "definite article", "size 1", "Alligator"
OUT: "ERROR"
IN: "definite article", "big", "pet 1"
OUT: "The small cat."
IN: "indefinite article", "big", "pet 1"
OUT: "A small cat."
V
IN: **.**.
"", "pet 2"
OUT: "small dog."
Highlight
Erase
Q
8
7
503
x
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 8 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT