1. Write a little console application taking an input file and
outputing the result to the console.Typical usage : java -jar calc.jar input.txtInput file format :
expression : number [ operator number ] [ expression ]
operator : ( + | - | * | / )
number : ( 0|1|2|3|4|5|6|7|8|9 ) numberSample input file :
2 + 3 * 2 / 5 - 3
Sample console output :
2 + 3 * 2 / 5 - 3 = 0.2
Res : Operators “*” and “/” have priority on “+” and “-”.
outputing the result to the console.Typical usage : java -jar calc.jar input.txtInput file format :
expression : number [ operator number ] [ expression ]
operator : ( + | - | * | / )
number : ( 0|1|2|3|4|5|6|7|8|9 ) numberSample input file :
2 + 3 * 2 / 5 - 3
Sample console output :
2 + 3 * 2 / 5 - 3 = 0.2
Res : Operators “*” and “/” have priority on “+” and “-”.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货