Calculator.java:
/**
* @Title:Calculator.java
* @Package:com.you.model
* @Description:封装计算的数值类
* @author:Youhaidong(游海东)
* @date:2014-6-15 下午10:40:34
* @version V1.0
*/
package com.you.model;
import java.io.Serializable;
/**
* 类功能说明
* 类修改者 修改日期
* 修改说明
* <p>Title:Calculator.java</p>
* <p>Description:游海东个人开发</p>
* <p>Copyright:Copyright(c)2013</p>
* @author:游海东
* @date:2014-6-15 下午10:40:34
* @version V1.0
*/
public class Calculator implements Serializable
{
/**
* @Fields serialVersionUID:序列化
*/
private static final long serialVersionUID = 1L;
/**
* 操作数一
*/
private double operandOne;
/**
* 操作数二
*/
private double operandTwo;
/**
* 运算结果
*/
private double result = 0.0;
/**
* 运算符
*/
private String operator;
/**
* 加法
*/
public double addition()
{
result = operandOne + operandTwo;
return result;
}
/**
* 减法
*/
public double subtraction()
{
result = operandOne - operandTwo;
return result;
}
/**
* 乘法
*/
public double multiplication()
{
result = operandOne * operandTwo;
return result;
}
/**
* 除法
*/
public double division()
{
result = operandOne / operandTwo;
return result;
}
/**
* @return the operandOne
*/
public double getOperandOne() {
return operandOne;
}
/**
* @param operandOne the operandOne to set
*/
public void setOperandOne(double operandOne) {
this.operandOne = operandOne;
}
/**
* @return the operandTwo
*/
public double getOperandTwo() {
return operandTwo;
}
/**
* @param operandTwo the operandTwo to set
*/
public void setOperandTwo(double operandTwo) {
this.operandTwo = operandTwo;
}
/**
* @return the result
*/
public double getResult() {
return result;
}
/**
* @param result the result to set
*/
public void setResult(double result) {
this.result = result;
}
/**
* @return the operator
*/
public String getOperator() {
return operator;
}
/**
* @param operator the operator to set
*/
public void setOperator(String operator) {
this.operator = operator;
}
}