PHP 5, PHP/Java Bridge & Apache on XP PRO + SP2 and
程序员文章站
2022-05-20 13:07:01
...
Example - SalesTax.java, salestax.php, salestax.htm C:\Program Files\Apache Group\Apache2\htdocs\test\SalesTax.java. import java.util.*;import java.text.*;public class SalesTax{ private double tax = 0.0; private double price = 0.0; private
Example - SalesTax.java, salestax.php, salestax.htm
C:\Program Files\Apache Group\Apache2\htdocs\test\SalesTax.java.
import java.util.*; import java.text.*; public class SalesTax { private double tax = 0.0; private double price = 0.0; private double salesTax = 0.0; public SalesTax() {} public String SalesTax(double price, double salesTax) { tax = price * salesTax; NumberFormat nf = null; nf = NumberFormat.getCurrencyInstance(); String priceOut = nf.format(price); String taxOut = nf.format(tax); nf = NumberFormat.getPercentInstance(); String salesTaxOut = nf.format(salesTax); String str = "Sales Tax of " + salesTaxOut + " on " + priceOut + " equals " + taxOut + "."; return str; } }
C:\Program Files\Apache Group\Apache2\htdocs\test\salestax.php
SalesTax($price, $tax); } ?>
C:\Program Files\Apache Group\Apache2\htdocs\test\salestax.htm.
上一篇: python中import语句是什么 ?有什么作用?
下一篇: photoshop 流线型导航栏