shippingcalculator.java

来自「Flex JSP Exchanging data」· Java 代码 · 共 37 行

JAVA
37
字号
package quickstart;

import java.util.ArrayList;
import java.util.List;
import java.lang.Math;

/*
////////////////////////////////////////////////////////////////////////////////
// ADOBE SYSTEMS INCORPORATED
// Copyright 2007 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
// terms of the Adobe license agreement accompanying it.  If you have received this file from a
// source other than Adobe, then your use, modification, or distribution of it requires the prior
// written permission of Adobe.
////////////////////////////////////////////////////////////////////////////////
*/

public class ShippingCalculator {

    /*  Returns a list of made-up ShippingOptions.
    */
    public List getShippingOptions(int zipcode, double pounds) {

        List        options = new ArrayList();
        double      baseCost;

        baseCost = Math.round(zipcode / 10000) + (pounds * 5);

        options.add(new ShippingOption("Next Day", baseCost * 4));
        options.add(new ShippingOption("Two Day Air", baseCost * 2));
        options.add(new ShippingOption("Saver Ground", baseCost));

        return options;
    }
}

⌨️ 快捷键说明

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