Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

I need some help

Write a program “simpleMath” that prompts the user to enter infix expressions. The expressions will be evaluated using an object of class “Evaluator”. Then, the result will be printed for the user. The program will continue until the user chooses to terminate by entering the word “END” as an expression. \ \ Class “Evaluator” has the following members: \ 1. Data: a. expressionQueue : a QUEUE that holds the infix expression operands and operations. For example, if the expression is: a + PI * ( b – area), the queue will contain: b. operandsV: an unsorted LIST that contains objects of class “Operand”. This list is used to hold values for each operand in the expression. For example: for the example given in (a.), the list may contain: a PI b area 12 3.14 2.3 2 c. Result: the result of the expression. 2. Methods: a. Evaluator (): constructor. b. Evaluate(String): receives the infix expression as a string and stores its result in the data member “Result”. This method must call all the three private methods. c. getResult(): returns “Result” value. d. stringToQueue(string): receives the infix expression string, from method “Evaluate”, and stores its operands and operations in “expressionQueue”. Assume that operands and operations are separated by one space and that operands names do not contain spaces. e. setOperands(): prompt the user to enter a value for each operand in the queue, and fills “operandsV” list. f. evaluateInfix(): evaluates the infix expression using “expressionQueue” and “operandsV” and stores the infix result in “Result
Your rating: None Average: 1 (1 vote)
Share this
1 answer
hertze_bogdan's picture
So what do you want from us? To send you the entire code?

Send us a snippet and we will gladly help you.

No votes yet