脚趾写字 2016-06-30 15:20 采纳率: 0%
浏览 1516

大神看看这道java题目,帮忙解决一下

Consider an expression like E:"123 * x + 456 * y * 12 - 200 / z" which follows the rules:
· may contain operands: +,-,*,/
· may contain variables (like 'x')
· may contain constants (like '123')
· does not contain parenthesis.
Write a set of Java classes to parse and "compile" expressions like E. Once the expression is "compiled"
it should be able to evaluated against a Map which would contain the value for the
variables. For example the expression "x + 2*y" would result to7 when evaluated against [x ->1, y ->3].
By "compiled" we mean that if the expression is to be evaluated against 1m inputs, the work of parsing
the expression into a set of Java classes should only be done once.
You should write a set of unit tests to show that your implementation is correct.
This is an Object Oriented Programing exercise. Focus should be put on good use of OOP principles
(encapsulation, good level of abstraction, low amount of duplicated code, design easy to extend, etc..)
and design patterns if necessary.
We recommend to use Maven, but you may use any other tool providing that you give sufficient
instruction to execute your code.
You may use generic libraries like Apache Common or Google Guava but you may not use scripting
libraries like JEXL, ANTLR or Grammatica.

  • 写回答

3条回答 默认 最新

  • 当作看不见 2016-06-30 15:52
    关注

    强烈建议,先翻译完再过来,

    评论

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用