Question: 1 . Write a program that uses an ArrayStack to store the vowels, digits and arithmetic symbols from an input string. You will have 3
Write a program that uses an ArrayStack to store the vowels, digits and arithmetic symbols from an input string. You will have objects of the ArrayStack class. You may use the ArrayStack template class from Module Resources.
The input will come from the user prompt your user for a line of text, push all vowels, digits and symbols from the input string onto their respective stacks. The stack may only contain one element of each vowel and digit. Hint: How do you know if you've pushed an a onto the stack already?
Display the stacks.
Calculate the result of the top two arithmetic symbols if a is on the top of the symbols stack, pop two digits from the digits stack and add them, if the symbol is multiply them and so on you need to account for any arithmetic operator Calculate the first result from the top most arithmetic symbol, use that result with the next arithmetic symbol and the next digit. Display the final result. Your input is guaranteed to have at least three digits and at least two arithmetic symbols although you should handle the case where there are too few digits or symbols to process...
A sample run might look like this user input is in red remember that the last element pushed is the first one out:
Input a string: The quick brown fox jumped over the lazy dog
Vowel stack:
o
a
e
i
u
Digit stack:
Symbol stack:
Result:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
