Write a function named createTwoNames that will do the following: - Read in a word and its definition - Create the Word object for that word and definition - Read in an item’s name and its price - Create the Item object for that item - It will return an array of two pointers pointing to these newly created Word and Item objects. It will use try-catch statement to handle the exception. If the user enters an empty or all-blank word or definition or item’s name, it will not create the object(s) and return null for that object only. In another words, it may create 0, 1 or 2 objects. Whenever the error occurs, it must print out the correct error reason: empty or blank (but not both). Note that this function can and will use cin and cout to read in values from the user.
in c++
Write a function named createTwoNames that will do the following:
- Read in a word and its definition
- Create the Word object for that word and definition
- Read in an item’s name and its price
- Create the Item object for that item
- It will return an array of two pointers pointing to these newly created Word
and Item objects.
It will use try-catch statement to handle the exception. If the user enters an empty
or all-blank word or definition or item’s name, it will not create the object(s) and
return null for that object only. In another words, it may create 0, 1 or 2 objects.
Whenever the error occurs, it must print out the correct error reason: empty or
blank (but not both).
Note that this function can and will use cin and cout to read in values from the
user.

Step by step
Solved in 4 steps with 4 images









