1

Unsure how to approach this.

SOP expressions are sums of products of doubles:

Expression ::= Sum | Product
Sum ::= Product~("+"~Product)*
Product ::= Double~("*"~Double)*

The SOP console reads a string from the keyboard and breaks it into a list of sub-strings separated by + signs. These sub-strings are broken into a list of sub-sub-strings separated by * signs. The sub-sub-strings should be parsable as doubles. (Otherwise and exception should be thrown.)

The lists of sub-sub-strings should be converted into instances of a Product class. Lists of products should be converted into lists of expressions

[https://i.stack.imgur.com/xxkUG.png][1]

Money Heer
  • 11
  • 2
  • For a starting point you may have a look at [Evaluating a math expression given in string form](http://stackoverflow.com/questions/3422673/evaluating-a-math-expression-given-in-string-form) – andih Feb 03 '17 at 09:25

0 Answers0