Ruby on Rails Monday, January 5, 2015

Given an expression:  2 + ( ( 4 + 6 ) * (9 - 2) - 5 - 1) + 1
1. Write a program calculate the given expression
2. Do not simply use "eval" directly
3. Need unit test

Bouns:
2 + ( ( 4 + 6 ) * sqrt(5) + 3) / 2  + 1

Here is my code, who can improve this for me? Thank you!
Here is test code.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/feeb4542-9acb-48d1-96e3-445e8a8ae9af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment