Question: write a java function called calculate that simulates a simple calculator. given a mathematical expression stored into a string, your function should calculate a result

write a java function called calculate that simulates a simple calculator. given a mathematical expression stored into a string, your function should calculate a result and return it as a double. for example, if your function is passed the string 3.7 + 4.2 it should return the number 7.9. your calculator only needs to handle two operators + and *, and only expression containing two operands and a single operator. the three components will always be separated by a single space between each.

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!