Question: Write a function named getProduct(text) where text is a string showing the product of several positive integers. The function must evaluate the expression in text

 Write a function named getProduct(text) where text is a string showing

Write a function named getProduct(text) where text is a string showing the product of several positive integers. The function must evaluate the expression in text and return the answer. For example, if text = "12*2*10" then getProduct(text) must return 240. Similarly, if text = "4*2*3*1" then getProduct(text) must return 24. You can assume that text is always a valid expression (e.g., as in the examples above) and will not contain any character other than digits and *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!