跪求JAVA编写的银行利息计算器代码

来源:百度知道 编辑:UC知道 时间:2024/05/31 14:51:37
要求很简单,实现利息计算就可以了,包括活期,定期,还有本息计算等,希望有可以帮助的好心人!
我也想编写呀!可是我编号了界面之后就不懂那些算法了,现在在郁闷呀!JAVA例题我也看了很多了,就是没有那个计算器的代码,希望有人可以帮助小弟弟呀,万分感谢!

这个很简单,只是我对这些计算规则不熟悉
import java.util.ListIterator;
import java.util.Stack;

public class CalStr {
private String src;

/**
* constructor
*
* @param srcthe string(expression) to calculate
*/
public CalStr(String src) {
this.src = src;
}

/**
* calculate to get the result
*
* @return(double)result
*/
public double getResult() {
String postfix = getPostfix();
Stack stk = new Stack();
// System.out.println(postfix);
String parts[] = postfix.split(" +");
double result = 0;
for (int i = 0; i < parts.length; i++) {
char tmp = parts[i].charAt(0);
if (!isOperator(tmp)) {
stk.push(parts[i]);
} else {
double a = Double.parseDouble((String) stk.pop());
double b = Double.parseDouble((String) stk.pop());
// b is followed by a in the orignal expression
result = calculate(b, a, tmp);
stk.push(String.valueOf