pty string value, it will create a Variable object, otherwise it will create a VariableString object. It will return the pointer of

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.2: Returning A Single Value
Problem 13E
icon
Related questions
Question

in C++

 

Write a function named “createVariableObject” that will read in the variable name, description and
a value (string) from the user and create a dynamic Variable or VariableString depending on the value: if the user provides an empty string value, it will create a Variable object, otherwise it will create a VariableString object. It will return the pointer of the newly created object.

This function must handle all error cases for invalid variable names entered by the
user: starting with a non-alphabet letter or containing blanks by handling exception using
try-catch. It will print out proper error message and continue to ask the user for
the new value until it is correct name.
Please show how this function is being tested and
print out the correct variable information.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,