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"
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
I need acurate answer with explanation so, please solve it carefully.

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

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

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

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education