脚趾写字 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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题