converterbean.java

来自「JavaeeTutorial5的源代码。」· Java 代码 · 共 38 行

JAVA
38 行
字号
/* * Copyright 2007 Sun Microsystems, Inc. * All rights reserved.  You may not modify, use, * reproduce, or distribute this software except in * compliance with  the terms of the License at: * http://developer.sun.com/berkeley_license.html */package converter.ejb;import java.math.BigDecimal;import javax.ejb.Stateless;/** * This is the bean class for the ConverterBean enterprise bean. * Created Jan 20, 2006 1:14:27 PM * @author ian */@Statelesspublic class ConverterBean implements converter.ejb.Converter {    private BigDecimal euroRate = new BigDecimal("0.0070");    private BigDecimal yenRate = new BigDecimal("112.58");    public BigDecimal dollarToYen(BigDecimal dollars) {        BigDecimal result = dollars.multiply(yenRate);        return result.setScale(2, BigDecimal.ROUND_UP);    }    public BigDecimal yenToEuro(BigDecimal yen) {        BigDecimal result = yen.multiply(euroRate);        return result.setScale(2, BigDecimal.ROUND_UP);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?